jQuery UI Widgets Forums Lists ListBox Listbox doesn't show after Jquery empty()

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 9 years, 5 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Listbox doesn't show after Jquery empty() #79642

    moby41
    Participant

    Me again..
    My server will send several batches of data for Listbox to show on front page.
    It means one batch corresponds to one Listbox.
    After one batch was showed on page, if another batch came, I should remove the old one and print a new Listbox on page.
    In this case, I use $("#listbox").empty(); before any $('#listbox').jqxListBox()
    And the weird thing is that the second batch of data doesn’t show Listbox on page, it do remove the old one, so it appears blank..
    I’ve checked that after empty() function, the listbox div still remains alive.
    Any suggestion you can give me? Thanks..

    Listbox doesn't show after Jquery empty() #79657

    Peter Stoev
    Keymaster

    Hi moby41,

    You remove the ListBox with empty() call so how do you expect it to show itself after that? You should use only the widget’s API to work with the widget. If you want to remove the widget from the DOM use its “destroy” method.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Listbox doesn't show after Jquery empty() #79689

    moby41
    Participant

    Hi Peter,

    That’s very helpful. Since I’m not familiar with widget, and it looks like I need to overwrite “_destroy” method, so I decided to add document.createElement("div") method after removed it. It works fine. Thank you for your reply.

    Listbox doesn't show after Jquery empty() #79695

    Peter Stoev
    Keymaster

    Hi moby41,

    I suggest you to look at the widget’s API. There’s no _destroy method, there is “destroy” method within the API Docs and there is example there how to use it.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.