Results 1 to 2 of 2

Thread: PivotGrid and custom cells with checkboxes - getting data

  1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    16
    Vote Rating
    0
      0  

    Default PivotGrid and custom cells with checkboxes - getting data

    This is my first post here, so at first I would like to say Hello ;-).

    Now let's go down with the business,
    I am struggling with the problem of checkboxes inside of every cell of Ext.grid.PivotGrid.

    This is what i have at the moment:
    transitions table_3.png

    The checkboxes are visible and depends on provided data. Initial values are generated in the way that fits my needs, but I can not find any way to set up something like
    on_data_change
    for every checkbox.

    Here is how I generate these checkboxes:
    Code:
    renderer:function (value) {
                var str = '';
                if (value !== 0) {
                    str = 'checked';
                }
                return String.format(
                    '<input type=checkbox ' + str + ' />'
                );
            }
    .
    So now, if I have my cell rendered using my custom render, am I still able to retrieve checkbox specific data changes ?

  2. #2
    Sencha Premium User
    Join Date
    Dec 2016
    Posts
    6
    Vote Rating
    0
      0  

    Default checkbox cells in pivot grid

    Hi! Could you tell me how did you generate those checkboxes? I mean, I'm looking at the code U posted, but I have no idea where to include it. Could you explain more about how you managed to render a checkbox in the cells of the pivot grid? At the moment I'm using sencha architect version 4.1.2.188, I mention it just in case.
    Thanks a lot!!

  3. #3
    Sencha Premium User
    Join Date
    Dec 2016
    Posts
    6
    Vote Rating
    0
      0  

    Default solution

    Quote Originally Posted by developer2innovate View Post
    Hi! Could you tell me how did you generate those checkboxes? I mean, I'm looking at the code U posted, but I have no idea where to include it. Could you explain more about how you managed to render a checkbox in the cells of the pivot grid? At the moment I'm using sencha architect version 4.1.2.188, I mention it just in case.
    Thanks a lot!!
    I finally could figure it out,I'm sharing it in case someone else needs it.

    You need to create the checkbox dynamically so that you can set the change event manually, here is the code:

    renderer: function(value, record, dataIndex, cell, column) { //in the view, you add a renderer(function) to the pivot grid aggregate you are interested in working with
    //personal code I needed to do. In my situation the checked value depended on the parameter value
    var valueCheck;
    if(value==1){
    valueCheck=true;
    }else{
    valueCheck=false;
    }

    //creation of checkBox
    var id = Ext.id();
    Ext.defer(function () {
    Ext.widget('checkbox', {
    renderTo: id,
    checked:valueCheck,
    listeners: {
    change: { //the change event in a checkBox is the equivalent to the click event in a button
    fn: function (event, target) {
    if(target == true){
    console.log('checkBox checked');
    }else{
    console.log('checkBox not checked');
    }
    }
    }
    }
    });
    }, 50);
    return Ext.String.format('<div id="{0}"></div>', id);
    },

    I hope someone finds it useful, bye.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •