summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2010-10-13 12:51:16 +0000
committerTed Trask <ttrask01@yahoo.com>2010-10-13 12:51:16 +0000
commit6298d6adc2626dd9e30f6af6f173c355a1036395 (patch)
tree21f033894320573d27a4f33c421eadf07a7008e4
parent355cfe88af319bffe7dfc381225c9b5f1c05541e (diff)
downloadacf-core-6298d6adc2626dd9e30f6af6f173c355a1036395.tar.bz2
acf-core-6298d6adc2626dd9e30f6af6f173c355a1036395.tar.xz
Modified displayform to look for 'seq' field if order is not specified
-rw-r--r--lib/viewfunctions.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/viewfunctions.lua b/lib/viewfunctions.lua
index 14c0df8..c0a9240 100644
--- a/lib/viewfunctions.lua
+++ b/lib/viewfunctions.lua
@@ -105,6 +105,21 @@ end
function displayform(myform, order, finishingorder, page_info)
if not myform then return end
displayformstart(myform, page_info)
+ if not order and not finishingorder then
+ tmporder = {}
+ for name,item in pairs(myform.value) do
+ if tonumber(item.seq) then
+ tmporder[#tmporder+1] = {seq=tonumber(item.seq), name=name}
+ end
+ end
+ if #tmporder>0 then
+ table.sort(tmporder, function(a,b) return a.seq < b.seq end)
+ order = {}
+ for i,val in ipairs(tmporder) do
+ order[#order+1] = val.name
+ end
+ end
+ end
local reverseorder= {["redir"]=0}
if order then
for x,name in ipairs(order) do