質問

Is it possible to disable specific rows displayed in a dojo dgrid? I want to still display them, but not allow the user to select/edit them.

Let's say that out of 10 rows that my dgrid has, I want to disable 3.

Cheers

役に立ちましたか?

解決

The editor plugin supports a canEdit function on the column definition object in cases where editOn is specified. This function receives the data item for the row, and the value to be rendered (e.g. as determined by the column's field or its get function). Returning false from this should result in the cell for that particular row not being editable.

The Selection mixin supports an allowSelect method which receives a row object (i.e. as produced by grid.row(...)), and determines whether that row is selectable based on its return value.

他のヒント

You have to set the editable property of the col as false. If you are declaring grid programitically then in you can specify this. In case of declarative, then need to specify in layout then with col definition you need to give editable: false

Yes it's possible. If the selection-mixin & editor-plugin are not 'mixed in', the default dgrid will have the desired functionality. If you need to provide selection programmatically but not by user or depending on some condition, you can use the dgrid/Selection mixin and have

selectionMode : 'none'

similarly you can set

editable: false

if you need the editor plugin & want to disable for some reason/condition.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top