Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1150
add custom attribute to cells inside igGrid
posted

Hi,

Couple problems I need help on:

- Is it possible to add custom attribute to <td> tags inside igGrid ? I need to know what kind of data is inside that cell, so ideally I want to add attribute corresponding to the column key, something like: <td data-type="Price"></td>.

- Is it possible to change column setting property on the fly ? For instance, I need column A to be read only when rendered, but based on user input on editing, I want to change column A to be editable.

Thanks,

Jeffrey

Parents
  • 23953
    Suggested Answer
    Offline posted

    Hi Jeffrey,

    jAndika said:
    - Is it possible to add custom attribute to <td> tags inside igGrid ? I need to know what kind of data is inside that cell, so ideally I want to add attribute corresponding to the column key, something like: <td data-type="Price"></td>.

      

    Yes, you can. You can see that we use data-id attributes on the TR elements to indicate the primary key value of the row.

    jAndika said:
    - Is it possible to change column setting property on the fly ? For instance, I need column A to be read only when rendered, but based on user input on editing, I want to change column A to be editable.

     

    I'm afraid that you cannot set readOnly column setting on the fly, but you can set a cell in edit mode to be read only. First you should bind to editCellStarted event. In the event use ui.editor parameter to gain access to the igEditor, then set igEditor to be read only.

    Here is an example code:

    Code Snippet
    1. editCellStarted: function(evt, ui) {
    2.     if (ui.columnKey === "Name") {
    3.         var e = ui.editor;
    4.         $(e).igEditor("option", "readOnly", true);
    5.     }
    6. }

     

    Hope this helps,

    Martin Pavlov

    Infragistics, Inc.

Reply Children