Thanks Anthony...

On Sunday, 24 May 2015 03:16:00 UTC+5:30, Anthony wrote:
>
> Your code is incorrect. Instead of inserting the full navbar object, you 
> apply a string of methods to it and insert the return value of the final 
> method (which is None). As in the original code example, you must assign 
> the navbar to a variable, then apply the manipulation, and finally insert 
> the edited navbar:
>
> {{navbar = auth.navbar(mode='dropdown')
>   if auth.user:
>       navbar.element('ul.dropdown-menu').components.extend([LI('Item 1'), 
> LI('Item 2'), ...])}}
> {{=navbar}}
>
> Anthony
>
> On Saturday, May 23, 2015 at 12:00:23 PM UTC-4, Neeraj Shukla wrote:
>>
>>
>> <https://lh3.googleusercontent.com/-OK9lM0zgP4c/VWCkDG6uOUI/AAAAAAAAALs/RjjEwoaloSc/s1600/web2py_query.png>
>>
>>
>> <https://lh3.googleusercontent.com/-OK9lM0zgP4c/VWCkDG6uOUI/AAAAAAAAALs/RjjEwoaloSc/s1600/web2py_query.png>
>>
>> Following code I used and it produces None in HTML markup
>> {{=auth.navbar(mode='dropdown').element('ul.dropdown-menu').components.extend([LI('Item
>>  
>> 1'), LI('Item 2')])}}
>>
>>
>> Couldnt figure it out. 
>>
>> On Saturday, 23 May 2015 19:16:44 UTC+5:30, Anthony wrote:
>>>
>>> Hmm, seems to work for me. Can you show your exact code as well as the 
>>> HTML markup that ends up in the browser?
>>>
>>> On Saturday, May 23, 2015 at 6:01:34 AM UTC-4, Neeraj Shukla wrote:
>>>>
>>>>
>>>> navbar = auth.navbar(mode='dropdown')
>>>> if auth.user:
>>>>     navbar.element('ul.dropdown-menu').components.extend([LI('Item 1'), 
>>>> LI('Item 2'), ...])
>>>>
>>>> Above method is not working on web2py 2.10.4
>>>>
>>>> however jquery works. 
>>>> For example
>>>> {{block page_js}}
>>>> {{if auth.user:}}
>>>> <script>
>>>>     jQuery("ul.dropdown-menu").append('<li>item 1</li>');
>>>> </script>
>>>> {{pass}}
>>>> {{end page_js}}  
>>>>
>>>> However, use of javascript may slowdown page loading. Can anyone please 
>>>> suggest better working approach for mentioned web2py version ?
>>>> On Tuesday, 30 April 2013 20:50:52 UTC+5:30, ctrlSoft wrote:
>>>>>
>>>>> hi, how to add items in 
>>>>> <ul class="dropdown-menu" style="display: block;">
>>>>> ...
>>>>> ...
>>>>> ...
>>>>> </ul>
>>>>> generated by auth.navbar(mode="dropdown"),
>>>>>
>>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to