[4.0.4] - How to set a Lookup value (Picklist) in a Grid Con

Posted by Meryk on 18-Jan-2016 04:43

Hello,

I have a Grid Control on a new page, where I have a Lookup field rendered as a picklist.

On change of another field (outside of the grid) I need to create a number of rows in the grid, and set the values of the lookup (picklist) field, for each row.

How can I achieve that please ? 

Only method I can see is rbf_setGridPicklistCode, but we don't have codes in these picklists in the Grid.

Tried rbf_setGridContent2 but this is only setting html content, but not selecting an item from the picklist. 

Tried rbf_setGridValue2, but no value is set.

I also need the picklist to stay visible and editable after setting a value.

Any ideas please?

Thank you

Meryem

All Replies

Posted by Shiva Duriseati on 21-Jan-2016 06:54

Hi Meryem,

You can use "onchange" event handler for the picklist which is outside the grid. Define a function in script component .

Example:

I am using onSelect function for picklist(which is outside the grid).

Define the codes for the picklist,based on the picklist value we can add gridrows.

<script>  

function onSelect()

{

 //Clear the grid whenever there is a change in the picklist value

 var selVal=rbf_getPicklistCode("SelectValue");

 for(var i=0;i<selVal;i++){

 rbf_addGridRow(0);

 rbf_setGridPicklistCode(0, 'pick', i, "sample");

 }

}

 </script>

Please find attached screenshots, also let us know if you need any assistance.

Regards,

Shiva

This thread is closed