Thanks Jim.

One short question: will ComplexPanel create a table-based structure or a 
div-based structure? I have the feeling that the bootstrap components will 
not be functional if they are structured as tables.

Br,
Daniel

On Tuesday, July 10, 2012 5:05:56 PM UTC+2, Jim Washington wrote:
>
> Descend from ComplexPanel. It has the "add" method you want.
>
> Jim
> On Jul 10, 2012 11:03 AM, "Daniel Gonzalez" <gonva...@gmail.com> wrote:
>
>> Hi,
>>
>> I would like to reuse a twitter bootstrap component. For that I need to 
>> create the following markup:
>>
>> http://twitter.github.com/bootstrap/javascript.html#modals
>>
>>
>>    1. <div class="modal hide" id="myModal"> 
>>    2. <div class="modal-header"> 
>>    3. <button type="button" class="close" data-dismiss="modal">×</button> 
>>    4. <h3>Modal header</h3> 
>>    5. </div>
>>    6.  <div class="modal-body"> 
>>    7. <p>One fine body…</p> 
>>    8. </div>
>>    9.  <div class="modal-footer"> 
>>    10. <a href="#" class="btn" data-dismiss="modal">Close</a> 
>>    11. <a href="#" class="btn btn-primary">Save changes</a> 
>>    12. </div>
>>    13. </div>
>>
>>
>> I have tried to create the structure using DOM.createDiv(), like this:
>>
>> class BootstrapDialog(HTML):
>>     def __init__(self, title = None, content = None):
>>         modal = DOM.createDiv()
>>         modal.setAttribute("id","myModal")
>>         modal.setAttribute("class","modal")
>>         header = DOM.createDiv()
>>         header.setAttribute("class","modal-header")
>>         body = DOM.createDiv()
>>         body.setAttribute("class","modal-body")
>>         footer = DOM.createDiv()
>>         footer.setAttribute("class","modal-footer")
>>         buttons = HTML('<a href="#" class="btn btn-primary">Save 
>> changes</a><a href="#" class="btn" data-dismiss="modal">Close</a>')
>>         footer.add(buttons)
>>         modal.add(header)
>>         modal.add(body)
>>         modal.add(footer)
>>         HTML.__init__(self, modal)
>>
>> The problem is that I get the following error:
>>
>> Uncaught TypeError: Object [object HTMLDivElement] has no method 'add' 
>>
>> How can I recreate a <div> structure in pyjs?
>>
>> Thanks,
>> Daniel
>>
>

Reply via email to