cancel
Showing results for 
Search instead for 
Did you mean: 

How to reset the selected item in table?

Former Member
0 Kudos

Hello,

I am using sap.m.table. In "sap.m.ListMode.SingleSelectLeft" if user has selected one of the list item then this selection will be retaining  when user visits the page again unless I programmatically deselect before going to that page. How to make it by default none of the listitem is selected? I have similar issues with visibility of few controls. If its by default hidden in view and based on some action it would be enabled but when I go back to same page later the controls are visible .

Thanks,

Rashmi

Accepted Solutions (0)

Answers (4)

Answers (4)

juancarlosorta
Participant
0 Kudos

Hi Rashmi, I used this trick to reset the selected item: At the end of attachSelectionChange method, I delete the mode selection of the table and then put it back.

var oTable = this.getView().byId("idTable");

oTable.setMode(sap.m.ListMode.SingleSelectMaster);

oTable.attachSelectionChange(function(oEvent) {

     ...

    oTable.setMode(sap.m.ListMode.Delete); // Delete mode selection

     oTable.setMode(sap.m.ListMode.SingleSelectMaster); // Put it back.

}

Hope this helps. Bye bye

former_member182372
Active Contributor
0 Kudos

Rashmi, instance of UI control is persistent within bootsrtap, so it will keep the status between interactions, so the only way ro reset the state is explicit logic like sugested. find appropriate event handler and place the logic there

Former Member
0 Kudos

Thanks Maksim. So the only way is to reset in controlller.

Former Member
0 Kudos

Hello,

have a look into the below link

Former Member
0 Kudos

Hi Nagarjun,

This doesn't help

Thanks,

Rashmi

kedarT
Active Contributor
0 Kudos

Hi Rashmi,

How about using removeSelections on the table when you are navigating back to the view with table.

Please specific the controls which you want to enable on navigation.

Hope this helps.

Former Member
0 Kudos

Hi Kedar,

Programmatically it works, is there a way to do it in view by default?

Thanks,

Rashmi

kedarT
Active Contributor
0 Kudos

Didn't get what do you mean by the below statement?


Programmatically it works, is there a way to do it in view by default?

                                                           

Former Member
0 Kudos

Well, I meant in controllers(javascript) i can reset the state but  is there a property in view which lets me to always set it to default.