Reputation: 8730
$('#grid').w2grid({
name: 'grid',
columns: [
{
field: 'code',
caption: 'Code',
size: '120px',
sortable: true,
resizable: true,
editable: {
type: 'text'
}
}
I want to make it edit with if condition like if other fields are empty I don't want to make it editable. How I do this?
Upvotes: 0
Views: 1997
Reputation: 10782
You have at least two options:
Either set record.w2ui.editable = false
for your specific record (this requires your data source to be dynamic and contain some sort of logic).
- or -
In w2ui 1.5, grid.columns[i].editable
can also be a function instead of an object, so you can write your own check function that will determine if the cell will be editable.
Quote from the source files:
col.editable can be a function which will be called with the same args as col.render()
Since the last one isn't well documented, I suggest you take a look at the implementation of getCellEditable()
in the w2grid.js sources to get an idea how the two options I mentioned will interact.
Upvotes: 2