cancel
Showing results for 
Search instead for 
Did you mean: 

Disabling the input field inside a table

Former Member
0 Kudos

I am using a table having 5 fields. i am displaying the data in the table with all the fields as inputfields. When i click a button, the rows having the data should become disable and the rows which doesn,t have the records should be in enable mode only.

Can we achieve this functionality ?

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Manjunath,

As per the snapshots that you have sent me I think that before the user presses on the u201CFreeze/Releaseu201D button he should for sure have pressed on u201CSave Entriesu201D. Right? So while you are writing these entries to your context you can do something. Take another Boolean attribute in your context node & set its value to X if the user has made an entry into the tableu2019s row. Now when you press on the Freeze button get your context data & say like loop at it_data where lv_flag = u2018Xu2019. So now you would get all those records only where the user has made some entries. Now change the context attribute which you have used for binding to your tables readOnly property. You should have only the desired rows set to readOnly & the rest would remain as enabled.

Regards,

Uday

Former Member
0 Kudos

Hi Uday,

Thanks for the reply.

I can read the existing entries i.e the lines which i need to make disable. But my question is show to set the particular row as disable or to make desired rows as disable inside the table?

uday_gubbala2
Active Contributor
0 Kudos

Hi Manjunath,

Thatu2019s what I had suggested the solution foru2026 I will try to put it down again. Take 2 Boolean attributes at your context level:

1) Would be a flag to know whether the user has entered any data in this particular row (Lets say flag1). By default set it to false so that it would mean that for the 1st time the entire table being displayed would have the flag1u2019s value as u2018 u2018.

2) Would be a variable for using to bind to the table columnu2019s readOnly property (Lets say flag2) By default have this value to false so that the entire column would be in editable mode by default.

Say suppose you want to make all the working days for which the user has made entries you should bind the cell editors readOnly property of all those columns to flag1.

When the user enters some data into a row and presses on the save then change the flag1 value for that particular row to X. (So this changes should get reflected on the context nodes data) So for example the user has entered data for first 2 rows then flag1 would be X for both these rows in the context node.

Now when the user presses on the Freeze button just get your entire contexts data & loop through only those records where you have flag1 = u2018Xu2019

Loop at it_data into wa_data where wa_data-flag1 = u2018Xu2019.
                Wa_data-flag2 = u2018Xu2019.
                Modify it_data from wa_data transporting flag2.
Endloop.

So now you would only set the readOnly value for the rows where flag1 = u2018Xu2019 (i.e., where the user has made his entries). The rest of the rows would still continue to have the default value defined at context level u2018 u2018 and so would remain as editable. I hope that you have understood what I intended to say.

Regards,

Uday

Answers (0)