Author Topic: Disable TRUE / FALSE for editor checkbox  (Read 4538 times)

jeff_b

  • Newbie
  • *
  • Posts: 9
    • View Profile
Disable TRUE / FALSE for editor checkbox
« on: December 23, 2015, 09:01:31 pm »
I am using the provided editor a cell  checkbox.  The question is that once we leave the cell, it becomes true or false instead of leaving the check box.

Is there a way to disable this and keep the checkbox always displayed?

I have tried the following:
Code: [Select]
render: function (ui) {
   var checked = (ui.rowData['AODBIndex'])
      if (checked)
          return ("<input type='checkbox' name='AO' checked='checked'>");
      else
          return ("<input type='checkbox' name='AO' >");
}

I have to set the checkbox to editable: false in order to keep the checkbox from becoming edit box so,

I combined this render function with a cellClick event for the checkbox cell that would toggle the value in a different cell based upon its current value.

ISSUE --> The issue with this method, the cells are never marked as dirty and therefore not sent to the database when the user clicks AcceptChanges.

Is there an easier way of doing this?
OR is there a way to manually tell paramgrid that a cell has in fact changed? (I don't mind if its a not cleared once I change the value back)

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6297
    • View Profile
Re: Disable TRUE / FALSE for editor checkbox
« Reply #1 on: December 28, 2015, 12:35:22 pm »
As it is not supported directly through public API of the grid, you have to manually call grid.iUCDate.update ( ) where grid is pqgrid javascript instance obtained by

$grid.data("paramqueryPqGrid"); or  $grid.pqGrid( 'instance' );

Code: [Select]
grid.iUCData.update({
rowData: rowData,
dataIndx: dataIndx,
oldVal: oldVal,
newVal: newVal
})
« Last Edit: December 28, 2015, 12:38:27 pm by paramquery »