Author Topic: sharing same config for multiple modules, but few module need to hide something  (Read 2063 times)

alonewolf149

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 56
    • View Profile
Hi ,i have applied param table in multiple modules with "show/hide column" features.

but some module , i want to hide this section :

http://prntscr.com/tu8dab

now we sharing param js, etc. is there any solution to hide this section only some of module ?

thanks
Thanut

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
You haven't shared any code, so I  presume you are using the same options for multiple grids.

First of all, the options need to deep cloned before sharing them across multiple grids.

Then you can remove a certain item from the toolbar for a certain grid by simple array manipulation methods like splice() on toolbar.items

alonewolf149

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 56
    • View Profile
we have sharing same code and even using same ID. http://prntscr.com/tugo5d

so in this case if some module we want to hide it how can we do

u refer about "simple array manipulation methods like splice() on toolbar.items"

can u more specific how can i hide it

this is i used for show show/hide

            /*hide/show columns*/
            {
                type: 'select',
                cls: 'columnSelector',
                attr: "multiple='multiple'", style: "height:60px;",
                options: function (ui) {
                    //options in the select list correspond to all columns.
                    return this.getColModel().map(function(column){
                        var obj = {};
                        obj[ column.dataIndx ] = column.title;
                        return obj;
                    });
                }
            },

thanks

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
It can be removed from the toolbar with this code.

Code: [Select]
obj.toolbar.items.splice(index, 1);
//initialize the grid.
pq.grid( "selector of grid", obj );

where obj is initialization object of grid and index is index of show / hide columns item in the toolbar.items array.