[luci] CBI: How do I filter based in the value of an option

Chris Martin chris at martin.cc
Tue Feb 16 09:33:37 CET 2010


On Tue, Feb 16, 2010 at 7:06 PM, Chris Martin <chris at martin.cc> wrote:
> I want to be able to display interfaces based on the "proto" option
>
> I want to do something like the following:
>
> m = map ("network", "title", "description")
> s = m:section(TypedSection, "interface", "")
> function s.filter(self, section)
>       return somehow_get_the_option(self, section, "proto") == "gre"
> end
>

As always - moment after going to the mailing list for help I have
managed to figure this out
I'm post the result for any one who is interested - or in case any one
has a better method

m = map ("network", "title", "description")
s = m:section(TypedSection, "interface", "")
function s.filter(self, section)
      return self.map:get(section, "proto") ~= "gre"        <---- here
is the magic
end

Cheers

> ----------------------------------------------------------
> Chris Martin
> m: 0419812371
> ----------------------------------------------------------
>


More information about the luci mailing list