jQWidgets Forums

jQuery UI Widgets Forums Lists ComboBox Knockout + ComboBox with Checkbox- Set the Default values

This topic contains 5 replies, has 2 voices, and was last updated by  Dimitar 12 years ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author

  • krisko
    Member

    I’m using Combobox with Checkbox so as to enable multi select option. Using KnockOut.js..
    It works perfect.. but my requirement is to select few checkbox on the first time it loads..
    Could you please advice if there is an option to bind the data to the control. so that it works fine on first load as well.

    even the $(‘#JQwidget’).jqxComboBox(‘checkIndex’, 0); does not set items.

    Please help!


    Dimitar
    Participant

    Hello krisko,

    In the ComboBox, you may add the following lines after ko.applyBindings:

                $("#list").jqxComboBox('checkIndex', 0);
    $("#list").jqxComboBox('checkIndex', 2);

    This way, the combobox will have its first and third items checked initially.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/


    krisko
    Member

    THe problem here is the data loads in a asynchronocus manner. So i want some event to identify that the loading has completed after which i can set the default items. I though i can try using the ‘bindingComplete’ event. But i could not figure out how to use this one in Knockout binding..? Could you pleasse provide the syntax.

    I tried mentioning like <div id="list" data-bind="jqxComboBox: {source: SelectableItems, valueMember: 'Code', displayMember: 'Name', selectedIndex: SelectedItemIndex, bindingComplete : bindingcompletemethod}

    and i have the corresponding bindingcompletemethod written in Viewmodel. but this never fires…

    Could you please help???????


    Dimitar
    Participant

    Hi krisko,

    After ko.applyBindings, the initialization has finished and the binding has completed. There is no need of the bindingComplete event in this case.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/


    krisko
    Member

    Hi Dimitar,

    Thanks for your update. But We do not use ko.applyBindings to bind the controls. It happens in an indirect way. Hence i want some Event..
    I also want the Events not just for this but also for Close event. Because for every checkbox (selected/unselected) view model gets hit and my service call happens. My requirement is to hit my service only when the combo box is closed.

    So I would need a solution to bind the event to this.
    Please help!!!


    Dimitar
    Participant

    Hi krisko,

    Please provide us with a code sample, so that we may better be of help.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.