Author Topic: 2 checkbox columns in PQGrid  (Read 3695 times)

Soumya

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 23
    • View Profile
2 checkbox columns in PQGrid
« on: February 12, 2014, 11:53:56 pm »
Is it possible to include two check box columns in the column model?
right now i am able to add only on check box column.

 var colM = [
            { title: "InvestmentID", width: 60, dataIndx: "InvestmentID" },
            { title: "Fund Name", width: 320, dataIndx: "FundName" },
            { title: "Company FundCode", width: 120, dataIndx: "CompanyFundCode" },
            { title: "Amount", width: 120, dataIndx: "AUM", dataType: "decimal" },
            { title: "Fund Characteristics", width: 110, dataIndx: "FundCharacteristic", dataType: "string" },
            { title: "IsSuspenseFund", dataIndx: "IsSuspenseFund", width: 50, align: "center", type: 'checkBoxSelection', cls: 'checkboxColumn', resizable: false },
            { title: "QDIA", dataIndx: "IsQDIA", width: 30, align: "center", type: 'checkBoxSelection', cls: 'checkboxColumn', resizable: false }
            ];
Below is the error i get when using 2 check box columns in one PQGrid
Uncaught TypeError: Cannot set property 'IsSuspenseFund' of undefined .

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: 2 checkbox columns in PQGrid
« Reply #1 on: February 13, 2014, 12:57:19 am »
It's possible to include any number of checkboxes but only column should have type: 'checkBoxSelection'.

The other columns (other than  type: 'checkBoxSelection') should use render function to display checkboxes.

Code: [Select]
render: function (ui){
  if(ui.cellData){//true
    return "<input type=checkbox checked=checked />";
  }
  else{
    return "<input type=checkbox />";
  }
}