Skip to content

Use rowId for unique value of checkbox column #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

d42ohpaz
Copy link

@d42ohpaz d42ohpaz commented Mar 11, 2020

From @nikitul

I made some bug fixes and some improvements including some of this request.
Source: here.
I supposed that if rowId is provided, it should be used. If not, is used cell.data().
I didn't used internal row number because that it could be changed using RowReorder or by adding new rows... and is a lot of extra work that could be avoided using a rowId.

Fixes #112

nikitul added 2 commits March 11, 2020 08:35
New features (v. 1.2.11):
-------------------------
If DataTables rowId is provided, it is used by this plugin;

Changed:
````
columns().checkboxes.selected(), column().checkboxes.selected()
````
Retrieves data for selected checkboxes (like the original);
If the column used with this plugin is rowID, will provide ids, if not, will provide cell.data()

Added functionality:
````
columns().checkboxes.ids(), column().checkboxes.ids()
````
Retrieves rowIds for selected checkboxes in columns
````
columns().checkboxes.data(), column().checkboxes.data()
````
Retrieves row.data() for selected checkboxes in columns.
This feature is usefull especially when serverSide is enabled and
selected row data from other pages than the current one is needed.


Renamed local variabiles to reflect more accurate the content of them:
cellsData to pluginIds
cellData to pluginId

Bug Fixes or deprecated functions removed (v. 1.2.11):
------------------------------------------------------
If FixedColumns extension is enabled, (specially when stateSave enabled) and the
column used for selection is not the first one, .dt-checkboxes-select-all cloned checkbox
does not have the correct checked / indeterminate property.

Removed
````
dt.fixedColumns().cellIndex()
````
because is [deprecated](https://datatables.net/reference/api/fixedColumns().cellIndex()) and does not work well with FixedColumns extension
@d42ohpaz d42ohpaz changed the title Use rowId for unique value of checkbox column #112 Use rowId for unique value of checkbox column Mar 11, 2020
@mpryvkin
Copy link
Member

Thank you for your contribution, @nikitul and @9ae8sdf76! Please allow me some some time to review the code.

I am not a fan of single commits that include lots of changes in multiple places. I also disagree with some suggested changes, for example, making the checkbox column searchable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use rowId for unique value of checkbox column
3 participants