Author Topic: Hide / show columns vs saveState  (Read 4034 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Hide / show columns vs saveState
« on: June 28, 2016, 02:00:45 am »
I have an issue with shown/hide columns not saved to saveState...

Toolbar code:

Code: [Select]
{
                        type: 'select',
                        cls: 'columnSelector',
                        attr: "multiple='multiple'", style: "height:60px;",
                        options: function (ui) {
                            var CM = this.getColModel(),
                                opts = [];
                            for (var i = 0; i < CM.length; i++) {
                                var obj = {},
                                    column = CM[i];
                                   
                                obj[ column.dataIndx ] = column.title;
                                opts.push(obj);
                            }
                            return opts;
                        },
                        listener: function (evt) {
                            var arr = $(evt.target).val(),
                                CM = this.getColModel();

                            for (var i = 0; i < CM.length; i++) {
                                var column = CM[i],
                                    dataIndx = column.dataIndx;

                                //hide the column if not a selected option.
                                column.hidden = ($.inArray(dataIndx, arr) == -1);
                            }
                            this.option("colModel", this.option("colModel")); //refresh the colModel.
                            this.refresh();
                        }
                    }

Function code:

Code: [Select]
create: function (evt, ui) {
                    var CM = this.getColModel(),
                        opts = [];
                    for (var i = 0; i < CM.length; i++) {
                        var column = CM[i];
                        if (column.hidden !== true) {
                            opts.push(column.dataIndx);
                        }
                    }
                    //initialize the selected options in toolbar select list.
                    $(".columnSelector").val(opts);

                    //convert it into pqSelect.
                    $(".columnSelector").pqSelect({
                        checkbox: true,
                        multiplePlaceholder: 'SELECT VISIBLE COLUMNS',
                        maxDisplay: 0, //100
                        width: '180px', //auto
                        displayText: 'SELECT VISIBLE COLUMNS'
                    });
                }

All other states is saved correctly.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6255
    • View Profile
Re: Hide / show columns vs saveState
« Reply #1 on: June 28, 2016, 06:19:06 pm »
Hidden state of columns are not saved/ restored currently. It has been added in TODO list for the upcoming versions, thanks for your feedback.

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: Hide / show columns vs saveState
« Reply #2 on: August 30, 2016, 04:48:44 pm »
Hi

Is there any update on this? Tried v3.3.2, but it still doesn't seem to work.