Show
Ignore:
Timestamp:
01/20/11 01:01:55 (2 years ago)
Author:
jow
Message:

libs/web: implement sortable rows for uci reordering

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • luci/trunk/libs/web/luasrc/cbi.lua

    r6608 r6762  
    5151CREATE_PREFIX = "cbi.cts." 
    5252REMOVE_PREFIX = "cbi.rts." 
     53RESORT_PREFIX = "cbi.sts." 
    5354 
    5455-- Loads a CBI map from given file, creating an environment and returns it 
     
    11221123    end 
    11231124 
     1125    if self.sortable then 
     1126        local stval = RESORT_PREFIX .. self.config .. "." .. self.sectiontype 
     1127        local order = self.map:formvalue(stval) 
     1128        if order and #order > 0 then 
     1129            local sid 
     1130            local num = 0 
     1131            for sid in util.imatch(order) do 
     1132                self.map.uci:reorder(self.config, sid, num) 
     1133                num = num + 1 
     1134            end 
     1135            self.changed = (num > 0) 
     1136        end 
     1137    end 
     1138 
    11241139    if created or self.changed then 
    11251140        self:push_events()