how to set default value in multiselect dropdown

43 views
Skip to first unread message

Nikhil Pratap

unread,
Sep 16, 2016, 5:31:06 AM9/16/16
to KnockoutJS

I have an application in which i am using query builder which allows users to build SQL queries from the dropdowns

available on UI.So basically I have three dropdowns avilable one for Column name,one for comparision operator,

one multiselect dropdown for column values against which user wants to search.So this multiselect dropdown values comes

directly from Database based on Column name selected.

e.g- user selected "CustomerName" from first dropdown,in comparision he selected "Equals(=)",then in multiselect

dropdown values will come from database for all customer names present in database.

 

<input class="inputDropDown" type="hidden" data-bind="value: selectStateAjax, visible :shouldShowDropDown,select2: { minimumInputLength: 0,allowClear:true, multiple:true, query: stateQuery}">

 

Here we are binding data by value. So when we click multiselect dropdown stateQuery method gets called which brings value from db based on Column selected in other dropdown an bind it on dropdown. But I want to set a default value to stateQuery. How would I do that.

Reply all
Reply to author
Forward
0 new messages