Example for selector-modifier
Example for selector-modifier
nikrou
Posts: 5Questions: 1Answers: 0
Hi all,
I try to limit selection on current page. I read carrefully https://datatables.net/reference/type/selector-modifier#Built-in-options.
But I do not understand how to inject selector-modifier object in dataTables configuration.
Any help is welcome. Thanks in advance
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
There is an example of selecting the rows on the current page:
https://datatables.net/reference/type/selector-modifier#page
If that is not what you are looking for then please post the code you are trying to work with and what specifically you want to select.
Kevin
Thanks for your answer. Of course it works.
I searched for a way to inject following object in the main dataTable parameters.
Where should I put the selector modifier ?
I see, you are looking for the Select Extension options. You will want to use the
select.selector
option.Kevin
But Kevin what value can I set to select only rows on current page ?
Are you trying to use
rows().select()
. If so then use the selector{page: 'current'}
. Like this example:http://live.datatables.net/fezumija/1/edit
Is this what you are trying to do?
Kevin
I'm afraid I should use what you proposed. I wish I can only use one parameter to tell that I only want selection on currrent page.
In my code I have a "select all" button, a "deselect all" button. Both must use that parameter. So the parameter value is duplicated. You must admit it's not really good. Of course it works and if I cannot do in another way I keep my code like that.
Anyway thanks for your help.
Not sure I understand the issue. What do you mean the parameter is duplicated? It is used once to tell the
rows()
API which rows to get followed by either theselect()
API or thedeselect()
API, for example:table.rows({page: 'current'}).select();
Kevin
And you must also use table.rows({page: 'current'}).deselect();
That is correct. If you don't want all the rows returned from
rows()
then you need to use a selector to define the rows you want.HTH,
Kevin