JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums Data Grid Define individual cell readonly property

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #109675
    Catdoken
    Participant

    Is it possible to individually define properties for a cell. My use case is being able to set whether a specific cell can be modified or not (readonly property).

    For example given the first column and two rows I’d like 0,0 editable and 1,0 not editable. I can use grid.setColumnProperty to change allowEdit to true/false but that is the entire column.

    I can locate the rows (grid.getRow), iterate the cells and modify the properties manually. The table does not pick this up which I was expecting. I did try using the refresh method, but I need to dig deeper to see what it is refreshing off of – the original column properties I provided or not.

    If this is possible what is the proper way to achieve this?

    Thanks!

    #109678
    Markov
    Keymaster

    Hi Catdoken,

    You can try the Grid’s onCellBeginEdit callback function. grid.onCellBeginEdit = (id, dataField, cellValue) => { if (id === 2) return false; }

    Best regards,
    Markov

    #109697
    Catdoken
    Participant

    Thanks for the reply.

    I will give that a shot, but will that make the cell readonly such that the user can’t double click and see the cursor?

    The example given is for Table rather than Grid; in my original post I used table once to describe grid, my mistake. Grid has onBeginEdit and it looks the same. I am utilizing Anulgar so its an EventEmitter where event.preventDefault() is supposed to halt an edit.

     

    Edit:

    I got this to work. What I ended up doing was set the readonly property of the cell to true/false. I tried this last week and it did not work but that was because I was using addEventListener instead of using onBeginEdit EventEmitter.

    Thanks!

    • This reply was modified 10 months, 1 week ago by Catdoken.
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.