Author Topic: Render readonly rows by default  (Read 2468 times)

kshipra

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 94
    • View Profile
Render readonly rows by default
« on: March 04, 2017, 01:08:46 am »
how can i render in grid on first time load , the whole row as readonly?

right now I pasted same callback function for each column in row to make entire row readonly. Is there more cleaner and efficient way to do this?

e.g.
{
                title: "Definition",
                editor: { type: 'textarea', attr: 'rows=5' },
                width: 350,
                dataIndx: "Definition",
                filter: { type: 'textbox', condition: 'contain', listeners: ['keyup'] },
                editable: function (ui) {
                    if (ui.rowData['IsBaseEvent'] === true) {
                        return false;
                    } else {
                        return true;
                    }
                }
            },
            {
                title: "Notes",
                editor: { type: 'textarea', attr: 'rows=5' },
                width: 350,
                dataIndx: "Notes",
                filter: { type: 'textbox', condition: 'contain', listeners: ['keyup'] },
                editable: function (ui) {
                    if (ui.rowData['IsBaseEvent'] === true) {
                        return false;
                    } else {
                        return true;
                    }
                }
            }
« Last Edit: March 04, 2017, 01:55:46 am by kshipra »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6282
    • View Profile
Re: Render readonly rows by default
« Reply #1 on: March 08, 2017, 12:15:18 am »
There is no need to specify editable for every column.

There is a global editable option for rows. https://paramquery.com/pro/api#option-editable

Code: [Select]
editable: function (ui) {
                    if (ui.rowData['IsBaseEvent'] === true) {
                        return false;
                    } else {
                        return true;
                    }
                }