Skip to Content
0

Multiselect modify event

Jun 09, 2017 at 03:30 PM

101

avatar image

Hello ,

i'm currently using a MultiSelect mode on my table. After some items are selected, some actions are triggered and those checkboxes which were enabled are now disabled in the table.

I am not able to click on each of them. However, when i click the checkbox in the Table header it selects all checkboxes, even if they 're disabled. See the picture below:

Is there any way to handle the onClick of the checkbox in the column header, so it will only check enabled checkboxes? Making the checkboxes not editable didn't work..

multiselect.png (1.7 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Dennis Seah
Jun 10, 2017 at 09:35 PM
0

Hi David

Does this http://jsbin.com/wowenoz/edit?js,output help you to move forwards?

Thanks

Dennis

Show 1 Share
10 |10000 characters needed characters left characters exceeded

hi Dennis,

this looks great. Thank you !

0
Sharath M G Jun 11, 2017 at 05:17 AM
0

Look for the event which is unique to the click on the table rows. Possibility that your event is generic and some other code is being trigerred.

It is very much possible to do a select all.

By default the table come with the option, you may need to assign an event handler and write for it. Else, have a button in table with select all/deselect all - toggle option

In handler method, loop through table items and set the selected option as true.

Regards,

Sharath

Show 1 Share
10 |10000 characters needed characters left characters exceeded

While looping through items, check if the item has the enabled property "true" and if yes, set selected as true.

0
Dennis Seah
Jun 09, 2017 at 06:57 PM
0

Hi David

Can you tell us how you disabled the checkboxes?

thanks

Dennis

Show 1 Share
10 |10000 characters needed characters left characters exceeded
this._oTable.getItems().forEach(function(i) {
		            var oContext = i.getBindingContext().getObject();
		            var oSavedFlag = oContext.HRFSAVED;
		            var oCB = i.$().find('.sapMCb');
		            var oCheckBox = sap.ui.getCore().byId(oCB.attr('id'));
		            if (oSavedFlag === "true") {
		              oCheckBox.setEnabled(false);

		            } else {
		              oCheckBox.setEnabled(true);
		            }
		 });

This is the code for disabling the checkboxes. Setting setVisible as well as SetEditable to false didn't work either

0