Set the first item selected by default in a related record s

Posted by ithrees on 20-Jun-2017 04:29

Hi,

In a case where you have a new record create page with a related record selector using 'Picklist' style and you want set the first item in that picklist selected by default. 

How this can be achieved with the new UI on Rollbase 4.4?

I tried,

var list = $("#R2244330_listbox").data("kendoDropDownList");
list.select(1);

but it didn't help.

Thanks & Best Regards,
-Ithrees.

Posted by Mohammed Siraj on 20-Jun-2017 04:56
The kendoWidget here is a kendoMultiSelect.
 
We need to first read the first item and then set its value.
 
Please use this code snippet as reference:
var kConfig = rbf_getFieldContext('R61322').getKendoConfig();
var firstItem = kConfig && kConfig.dataSource.data()[0];
var firstItemVal = firstItem && firstItem['value'];
if(firstItemVal){
  kConfig.value(firstItemVal);
}
 
 
Regards,
Siraj.
 

All Replies

Posted by Mohammed Siraj on 20-Jun-2017 04:56
The kendoWidget here is a kendoMultiSelect.
 
We need to first read the first item and then set its value.
 
Please use this code snippet as reference:
var kConfig = rbf_getFieldContext('R61322').getKendoConfig();
var firstItem = kConfig && kConfig.dataSource.data()[0];
var firstItemVal = firstItem && firstItem['value'];
if(firstItemVal){
  kConfig.value(firstItemVal);
}
 
 
Regards,
Siraj.
 
Posted by ithrees on 04-Jul-2017 00:28

Thank you Siraj.

This thread is closed