This topic contains 3 replies, has 2 voices, and was last updated by Jai Jai 5 months, 1 week ago.

How to disable checkbox at the time of loading data


  • hitesh-transpure.com
    Participant

    Posts: 1
    Member Reply #17330

    I have default checkbox to each row. I want to disable some checkboxes for certain conditions. Also how to add id to all checkboxes.

    Jai
    Jai
    Keymaster

    Posts: 2700
    Support Staff Reply #17388

    Hi 🙂

    The datatable does support condition to disable check at certain rows.

    You can disable checkbox from external using javascript.

    Have you checked the sample datatable?

    /src/js/demo/default/custom/crud/metronic-datatable/base/record-selection.js (v5.2 file location path)

    The selector is enabled at the id column, the value will be added to the checkbox value attribute.

    Thanks


    hitesh-transpure.com
    Participant

    Posts: 1
    Member Reply #17627

    I have checked this file but not useful. Can I loop through m_datatable and fetch  value of each column and set some property in checkbox or disable that checkbox ?. for eg there is a column “name” in the datatable and if name is “abc” then I want to disable checkbox of that row.

    Jai
    Jai
    Keymaster

    Posts: 2700
    Support Staff Reply #17643

    Hi 🙂

    Yes, you can do the loop through datatable and set checkbox property externally. Current datatable does not support condition to disable checkbox at certain rows

    You can try to do it after datatable has been initialized.
    datatable.on(‘m-datatable–on-layout-updated’, function(e) {
    });

    Thanks

You must be logged in to reply to this topic.