PDA

View Full Version : How to get ext.grid column model from outside ext JS (jquery on click)



softm
1 Apr 2011, 3:15 PM
Need hide/show column of ext grid, depending on external factors, not related to grid store.
Now i try simple thing:



$(document).ready(function(){


// =================== hide column/show column ========================
function show_announce()
{
Ext.namespace('Ext.ux');
Ext.namespace('Ext.ux.form');

// $.log( Ext.grid.getColumnModel() );
// $.log( grid.getColumnModel() );
// $.log( Ext.ux.grid.getColumnModel() );
$.log( grid.getColumnModel() );
}


// ===================
$( "#test-test" ) . click( function(){
show_announce();
return false;
});
});




But every variant of call this column model i try:


Ext.grid.getColumnModel()
grid.getColumnModel()
Ext.ux.grid.getColumnModel()
grid.getColumnModel()

is incorrect.


But, i can reload store from this same function with store.reload();

Dear developers and EXT users!
Please help me to hide or show column from JS.
Or get column model of extjs grid is inided and is active!


Arsen

softm
1 Apr 2011, 3:31 PM
it was global scope problemm of column model & grid vars. Both must be in glob.scope, ie without vars ...
So then start working
pls delete this ...

poojagarg89
3 Oct 2011, 11:04 PM
hey guys help me out...........
I have two grids with diff. column names n diff. forms for them and I want to make the grids hide() and show() when I click on tree.Panel......leaf nodes.......

like I have two leaf nodes under Admin that is : bulletin_users for grid1
and announcements for grid2

So I want wen i click on bulletin_users the grid1 should be visible with its respective toolbar in the ContentPanel and the grid2 should be hidden with its respective toolbar.........and viceversa wen I click on announcements


tell me the code which I should put into the listeners of TreePanel.

davisty
4 Oct 2011, 4:17 AM
Hello,

Ive used xtemplate to generate the html. Setting the id/class within the xtemplate that jquery will then access when the onclick is accessed.

poojagarg89
4 Oct 2011, 4:33 AM
Hey can U give me the code like how to use it actually M just a beginner and I searched for it but not getting how to apply in my code

davisty
4 Oct 2011, 5:50 AM
Im not in a position to get it for you now, but check this link out. It is kinda along the same thingy ...

http://demo.superdit.com/ext_listview_dataview/

Basically, your just building an html table with the xtemplate, then you access the id(s)/classes using jquery ...

Hope this helps.