Showing results for 
Search instead for 
Did you mean: 

Issue in Smart Table of type UI table row selection for editable fields : SAPUI5

0 Kudos

Hi ,

I'm having an issue with Smart table (OData binding) of type UI table on row selection.

Based on table row selection, on selected row I need to enable/disable a field .

For that I'm using expression binding , based on one other property value say X (that value I set from UI on row selection event), then dependent field gets enabled/disabled.

On the row selection event I'm handling this , which works fine for the first row .

But it doesn't work correctly for other than 1st row . Like if i select the 2nd row, it makes enabled 2nd & 3rd row field also without selection. (attached image).

I have tried all possible combinations of events handling , still the same behavior.

Also i have tried adding a custom property to the binding, but it behaves similar .

Seeking help/any suggestion on it ?

Note :- I have also tried with row Cell to set enable / disable explicitly, which works fine , but it's not good approach as if you scroll up-down, fields remains enabled for other rows too, so it has to be handled by model binding. we have OData model not JSON .

Active Contributor
0 Kudos

your code please.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi ,

I found the root cause of the issue, which i have reported above .

Here is what has happened .

Since I'm using smart table (type UI table) which is bound to an OData service .

So, the reported issue caused by the duplicate data , Yes you read it right .

If any line items has the same key value pair (duplicate line items) ,then table context path (OData) will consider it same . Hence, while applying any row specific changes gets applied to all the duplicate row items too.

If anyone is facing such issue, then hope this will be helpful to know. Check the data (key values).


MD Manauwar

Answers (1)

Answers (1)

Product and Topic Expert
Product and Topic Expert
0 Kudos


On the selection event, are you getting the row's binding context to determine which fields should be enabled/disabled?

var oTable = oEvent.getSource();
var oSelectedRow = oTable.getSelectedIndex(); 
var oSelectedContext = oTable.getContextByIndex(oSelectedRow); 

This method returns a binding context object which is an instance of the sap.ui.model.Context class and provides access to the properties of the row's data object. By getting the binding context object for the selected row, you can access the data properties of the row.

0 Kudos

Hi Leoni,

Thank you for the response .

Yes, I get the context of current selected row.

By using index as : oContext = oUiTable.getContextByIndex(iSelectedIndex).getPath();

OR without index as : oContext = oEvent.getParameters().rowContext.getPath();

then i set the property value to ODdata model as below

oModel.setProperty(oContext + "/status", "X");

And below expression binding responsible for the editable/no-editable ,

editable="{= ${status} === 'X'}"

which works fine for the 1st row but not for the other rows as it makes enable previous/next rows fields too.

and that's weird , trying that to resolved .