You need to sign in to do that
Don't have an account?

Preselect checkbox
I have a lightning datatable with checkbox. I want to preselect checkbox on load/refresh of the component. I was able to set selectedRows with id. Console log shows before and after the ids are set. However on UI the checbox does not appear. How can I show the checkbox with the checked mark?
some thing like this -
var idVal = ['a013D000003R0EQQA0'];
component.set("v.selectedRows", idVal);
console.log( ' Before ', component.get("v.selectedRows") );
component.set("v.selectedRows", idVal);
console.log( ' After ', component.get("v.selectedRows") );
some thing like this -
var idVal = ['a013D000003R0EQQA0'];
component.set("v.selectedRows", idVal);
console.log( ' Before ', component.get("v.selectedRows") );
component.set("v.selectedRows", idVal);
console.log( ' After ', component.get("v.selectedRows") );
Try using this:
<ui:inputCheckbox aura:id="checkbox" label="Select?" change="{!c.onCheck}" value="true"/> in the component.
Thanks,
Sowmya.
Thanks for the reply. I am using lightning datatable which comes with checkbox. I have not coded anything for checkbox.
Priya
I had the same problem and i tried the same method and every possible way but it didn't work, so used this link to do it :-
https://www.biswajeetsamal.com/blog/lightning-table-with-multiple-checkbox-select-options/
Thanks
Thanks for your reply. I have raised the case with salesforce. Will post the resolution.
Thanks,
Priya