Author Topic: Check box click event issue  (Read 365 times)

pranit@srcomsec

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 99
    • View Profile
Check box click event issue
« on: June 14, 2023, 08:31:34 pm »
We have added a checkbox to the grid with the below code in colModel.

When we click on the checkbox in row #1 then checked and if we click again then it does not uncheck.

If we click on row #2 & then click on row #1 then unchecked.

Please advise how to fix this so if click again and again on the same checkbox then checked/unchecked.

Code: [Select]
{
title: "Edit?",     
width: 50,
dataType: "bool",
align: "center",
editor: true,
type: 'checkbox',
editable: true,
cls: "largerCheckbox16NoToggle"
}

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Check box click event issue
« Reply #1 on: June 14, 2023, 10:56:53 pm »
editor should be set to false for a checkbox column.

Also set the dataIndx of the column for data binding.

pranit@srcomsec

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 99
    • View Profile
Re: Check box click event issue
« Reply #2 on: June 15, 2023, 08:01:03 pm »
Thank you for your quick response.

If we add "dataIndx" as per the code below then the checkbox is replaced with "true/false" text. I need a checkbox & the user can be checked/unchecked.

Also, please advise how to trigger the event & save the checkbox value in the database when the user checked/unchecked the checkbox.

Code: [Select]
{
title: "Edit?",     
dataIndx: "IsOnOff",
width: 50,
dataType: "bool",
align: "center",
editor: false,
type: 'checkbox',
editable: true,
cls: "largerCheckbox16NoToggle"
}

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Check box click event issue
« Reply #3 on: June 15, 2023, 08:16:24 pm »
1) dataIndx doesn't cause "true/false" text, please check these examples:

https://paramquery.com/pro/demos/checkbox

https://paramquery.com/pro/demos/export_pdf

Please share a jsfiddle if still facing issues.

2) check event is fired upon change in state of checkbox which can be used to save the values: https://paramquery.com/pro/api#event-check