We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to set Multicolumn Value form javascript

Hi,

I want to set multicolumn value from javascript can you guys please help.

1 Reply

PP Prasanth Palani Syncfusion Team November 14, 2016 07:01 AM UTC

Hi Chandan, 
 
Thanks for contacting Syncfusion Support. 
 
Query:  I want to know that how to set the value in Autocomplete Multicolumn in JS.  
You can set the value for Autocomplete using the Value property. When multi-column is enabled, the text box value will depend on stringFormat; so, you need to set the value property based on your stringFormat property.  
 
For example, in the below sample, we have set the stringFormat as “{0} ({3}) ({1})" and the value property is set based on the corresponding column index as like follows “10401 (Albuquerque) (1)”. 
 
 
 
$('#selectCar').ejAutocomplete({ 
              dataSource: window.gridData, 
              fields: { key: "OrderID",  text: "ShipCity" }, 
              highlightSearch: true, 
              value: "DRACD  (Aachen) (10391)", 
              watermarkText: "Select an order", 
              width:"100%", 
              showPopupButton: true, 
              multiColumnSettings:{ 
                  stringFormat: "{0}  ({3}) ({1})", 
                  enable:true, 
                  columns: [{field: "CustomerID", headerText: "CustomerID" }, 
                    { field: "OrderID", headerText: "OrderID" }, 
                    { field: "EmployeeID", headerText: "EmployeeID" }, 
                    { field: "ShipCity",  headerText: "ShipCity"  } 
                  ] 
                } 
           }); 
 
For your reference, we have prepared a simple sample for Autocomplete multicolumn support. You can get the sample from below jsplayground link, 
 
 
You can refer the following API reference section present in our online JS help document to know about the list of API’s, methods and events supported by each components, 
 
 
Please let us know, if you have any further assistance. 
 
Regards, 
Prasanth P 


Loader.
Up arrow icon