Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
905
How do I clear items in a DropDownProvider EditorControl
posted

Is it possible to add/remove items from the DropDownProvider/EditorControl at the client?

I have a specific set of values that are to be in the dropdown based upon the content of the WebDataGrid cell.  These values are available at the client.

For example, I've attempted to clear the dropdown items from the EditorControl (ddCtl)

items.get_length()remains the same,
and the
items.remove(items.getItem(0)) is performing an async postback

var items = ddCtl.get_items();

while (items.get_length())

       items.remove(items.getItem(0));

 

Any help would certainly be appreciated!

Thank you!

Parents
No Data
Reply
  • 24671
    Verified Answer
    posted

    Hi,

    If you are referring to adding and removing items on the client, add() and remove() will always do async postback, so that the server-side item collection st***nchronized with the client-side item collection.

    I suggest to also try to use getLength instead of the derived get_length, because  javascript objects ($IG.DropDownItem instances) are created on demand on the client, and get_length may return less than the visible number of items (html LI elements).

    For totally clearing the collection, you can also try calling dispose() on the item collection, i.e. items.dispose(). For the item references themselves you can do items._items = [] , but none of this will synchronize the server-side collection of items, or change the actual HTML markup for the dropdown list. 

    Thanks for your feedback,

    Angel 

Children