cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically change the cell editor in the table control

Madhu2004
Active Contributor
0 Kudos

Hi..

I have 3 columns in a table . of which in one column we need to change the cell editor dynamically at runtime.

i.e for example i have columns as carrid, connid and fldate.

For the first 2 rows the cell editor for the carrid clomn shud be a dropdown and from there on in the next rows for the same carrid column it shud be a input field.

Can experts plz help me how to achieve this as this is very high priority issue....

Regards,

Madhu...

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

This is actaully fairly simple to do. You will need to add a cellVariant to your table column. You can then dataBind a context attribute to the selectedCellVariant property of the column to control which cellVariant will be used. This allows you to control row-by-row which cell editor you want to output.

http://help.sap.com/saphelp_nw70/helpdata/EN/bd/5d9041d3c72e7be10000000a1550b0/frameset.htm

http://help.sap.com/saphelp_nw70/helpdata/EN/56/5e9041d3c72e7be10000000a1550b0/frameset.htm

Also here is an example that I did the other day that uses Cell Variants within ALV. This process is actually a little more complicated because you have to go through the ALV APIs. To do this in a normal table is actually easier because you can create the cellVariant in the layout designer.

Madhu2004
Active Contributor
0 Kudos

HI Thomas..

Thanks for the quick reply....

I created the design as u said and added cellvariant in the table column.I selected the cell variant type as STANDARD CELL.

I also created a attribute in the same node for which the table is binded of type string...

But what is the value i need to pass to this attribute to bind to selectedcellvariant property..

What is the value i need to pass if it is dropdown and what shud be passed in case of inputfield.

If two rows need dropdown can i write a supply function for the same ..

Regards,

Madhu..

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

When you created the CellVariant, there is a property called the variantKey. Whatever value you supply here is what need to have in your attribute bound to selectedCellVariant to trigger using this particular variant. No value supplied to selectedCellVariant will result in the standard editor being used.

>If two rows need dropdown can i write a supply function for the same ..

I'm afraid that I don't understand this question. The UI element sin the CellVariant work just like they would if they were the primary editor.

Madhu2004
Active Contributor
0 Kudos

Hi Thomas...

But where do i specify tht the cell editor is dropdown or input field...

Regards..

Madhu

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

After you create the cell variant, you can then right mouse click on it and choose insert editor. You then add whatever UI element you want to have for this particluar cell variant. You choose between the different cell editors by switching the selectedCellVariant as already described.

Madhu2004
Active Contributor
0 Kudos

Hi Thomas..

Thanks a Lot it solved my problem.....

Regards

Madhu

Answers (0)