0

I am create a LWC component using Slickgrid Universal 4.7.0 for custom datatable. However I can not set the checkbox column correctly. How can I config the option for this?

I already set the gridOption by (Row Selection)[https://ghiscoding.gitbook.io/slickgrid-universal/grid-functionalities/row-selection] as follows.

  enableAutoResize: true,
  enableCellNavigation: true,
  enableCheckboxSelector: true,
  enableRowSelection: true,
  rowSelectionOptions: {
    // True (Single Selection), False (Multiple Selections)
    selectActiveRow: false
  },

But screen is... enter image description here

onSelectedRowsChange event worked for SelectAll checkbox on filter header. But not for single row. Any other options are effected to this?

Please help on this.

And I want a screen like demo. enter image description here

2
  • By inspection, <input> and <label> tags are not created for each rows without any errors. Commented Jun 13, 2024 at 7:08
  • Perhaps the DocumentFragment class used to create the checkboxSelectionColumn is not supported by LWC, is there another way to replace it? Commented Jun 13, 2024 at 9:35

1 Answer 1

0

As you found out DocumentFragment are not supported by Salesforce and there are other settings that might be different as well. You can use preventDocumentFragmentUsage: false to disable fragment but it is recommended to simply use useSalesforceDefaultGridOptions: true in your grid options which is a better set of grid options for Salesforce and it was mentioned in the docs.

this.gridOptions = {
  useSalesforceDefaultGridOptions: true,
  enableAutoResize: true,
  enableCellNavigation: true,
  enableCheckboxSelector: true,
  enableRowSelection: true,
  rowSelectionOptions: {
    // True (Single Selection), False (Multiple Selections)
    selectActiveRow: false
  },
};
Sign up to request clarification or add additional context in comments.

3 Comments

I already set 'useSalesforceDefaultGridOptions' to true, without it Salesforce won't display the grid. However, the 'checkboxSelectorColumn' option doesn't seem to be affected by 'preventDocumentFragmentUsage:false'. I think the problem is that the 'createCheckboxElement' method in the source code 'slickCheckboxSelectColumn.ts' is supposed to use DocumentFragment only.
Modify the 'createCheckboxElement' code to use a span element instead of a DocumentFragment and build it, and it should show up on the screen at least. I need to check for events.
I already answered with the correct solution, just try it. That is what we use in our Salesforce

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.