Disable row selection
Disable row selection
nicoledramirez@hotmail.com
Posts: 60Questions: 14Answers: 2
Hi!
One more question.... I have the following conditional code:
```{
"data": "cdi_calendar_changes.active",
"render": function (val, type, row) {
return val == 0 ?
"<font color=red><b>LOCKED</b></font>" : "<input type=checkbox className=select-checkbox>"
orderable: false
}
},```
Problem is that the row that displays the Locked message can still be selected. But I need the selection functionality disabled.
Any suggestion?
Thanks!
This discussion has been closed.
Answers
In your event listener for row selection you can add something like:
select.style()
can be used to disable the selection of rows by setting it to benone
.Allan
Hi Allan,
I get a style undefined error. Tried:
```{
Ok, think I am close with what I was trying to do HPB's suggestion.
```"rowCallback": function (row, data, dataIndex) {
That code removes the checkbox. But I can still select the row. Tried to use the select style suggestion but it just makes the row not visible in my table. Also tried disable.
Oh I see! You want to do it on a per row basis, depending on the data in the row, rather than disabling row selection for the whole table?
If so, then the
user-select
event is the way to do it.Allan
Hi Allan,
Yes. I want to disable selection if the content in the cell that contains the value for cdi_address_book_relationships.active is 0
Please excuse my ignorance but I don't really understand the user-select function.
The example has a disable if 'img' is contained but its not really what I am after. Once I strip the class on the rowcallback, there isn't anything there but I can still select the cell and open the editor.
Based on your suggestion, I tried:
But it still allowed me to select the empty cell and open the editor.
Try:
Allan
Hi Allan,
Sorry, I should have posted that one too. I did try that before. Still allowed me to select the cell.
If you post a link to the page showing the issue I can take a look into it.
Thanks,
Allan
https://codeshare.io/50ADLg
Is the page available online somewhere so I can see it running including all required resources please?
Allan
No. I can't make the live version available. It's confidential info.
Can you send me it as a PM so that it isn't public?
Allan