Author Topic: New checkbox column added on Contextmenu but value reset and bg color not set  (Read 2953 times)

Jignesh

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 46
    • View Profile
Hi Paramvir,

I have gone through this link https://paramquery.com/pro/api#option-column-type .

I have created checkbox on contextmenu succefully,
But issue are following:
1) how to set background color for new column when click on checkbox (attached screenshot-->chk_1.png)
2) Value reset for new column checkbox on click checkbox or update text in same row. (attached screenshot--> chk_2.png)

Below are JSFiddle link:
https://jsfiddle.net/cherishPatel/h9514zLj/2/

Thanks,
Jignesh

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Please use Columns().add() API to add new columns.

Jignesh

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 46
    • View Profile
Hi Paramvir,

I have tried Column().add() method but it was not worked for below scenarios as mentioned upper post.

Below is jsfiddle for same:
https://jsfiddle.net/cherishPatel/oy2rq73d/2/

1)how to set background color for the new column when clicking on the checkbox (attached screenshot-->chk_1.png)
2) Value reset for new column checkbox on click checkbox or update text in the same row. (attached screenshot--> chk_2.png)

I have already added the screenshots for the first post of this thread.

Please give me your feedback.

Thanks,
Jignesh

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
1. Please add render callback to data column.

Code: [Select]
              render: function(ui){
              if(ui.rowData[dataIndx of checkbox column] =='YES'){
                  return {
                    style: {background: "#ff0000"}
                  }
                }
              },

and use check event to refresh the data column when checkbox is checked/unchecked.

Code: [Select]
check: function(evt, ui){
       if(ui.dataIndx == 'dataIndx of checkbox column')
          this.refreshColumn({dataIndx: 'dataIndx of data column'})
},

2. Please make adding new grouped columns a 2 step process. First add parent "New Column" column, then add its children columns with Columns.add() API separately.
« Last Edit: February 19, 2020, 10:40:21 pm by paramvir »

Jignesh

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 46
    • View Profile
Hi Paramvir,

I have not clearly understand, Can you please edit jsfiddle which I have given in this thread?

It is big help for me.

Thanks,
Jignesh

Jignesh

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 46
    • View Profile
Hi Paramavir,

Are you look into this?, Please give me sample jsfiddle code or edit my jsfiddle code. So I can take refrensh from them.

Thanks,
Jignesh

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
« Last Edit: February 26, 2020, 01:58:12 pm by paramvir »