-
3 Dec 2007 7:32 PM #1
Ext.grid.CheckColumn is not a constructor
Ext.grid.CheckColumn is not a constructor
this code example chowing how to use the CheckColumn plugin seems to work fine, but when I try and replicate it into my code I get:
Ext.grid.CheckColumn is not a constructor
I'm going by the edit-grid example in the ext.2.0 examples
I'm fairly new to javascript so I'm having a bit of trouble debugging this.
Any pointers would be greatly appreciated. Here's the CheckColumn plug-in in my code
in fact I get that is not a constructor error on anything that is a plug-in and extends some class, am I missing an include or something?
Code:<script type="text/javascript" charset="utf-8"> var grid_store; var selectionModel; var otherSelModel; var contact_grid; Ext.grid.CheckColumn = function(config){ Ext.apply(this, config); if(!this.id){ this.id = Ext.id(); } this.renderer = this.renderer.createDelegate(this); }; Ext.grid.CheckColumn.prototype ={ init : function(grid){ this.grid = grid; this.grid.on('render', function(){ var view = this.grid.getView(); view.mainBody.on('mousedown', this.onMouseDown, this); }, this); }, onMouseDown : function(e, t){ if(t.className && t.className.indexOf('x-grid3-cc-'+this.id) != -1){ e.stopEvent(); var index = this.grid.getView().findRowIndex(t); var record = this.grid.store.getAt(index); record.set(this.dataIndex, !record.data[this.dataIndex]); } }, renderer : function(v, p, record){ p.css += ' x-grid3-check-col-td'; return '<div class="x-grid3-check-col'+(v?'-on':'')+' x-grid3-cc-'+this.id+'"> </div>'; } }; Ext.onReady(function(){ Ext.QuickTips.init(); // turn on validation errors beside the field globally Ext.form.Field.prototype.msgTarget = 'side'; init_results_grid(); setup_form(); }); function init_results_grid() { //custom column plugin example var checkColumn = new Ext.grid.CheckColumn({ header: "Already in contacts?", dataIndex: 'on_contact_list', width: 55 }); json_reader = new Ext.data.JsonReader({ root: 'datarows', totalProperty: 'totalCount', fields: [ {name: 'id',type: 'int'}, {name: 'on_contact_list',type: 'bool'}, {name: 'first_name'}, {name: 'last_name'}, {name: 'email'}, {name: 'work_phone'}, {name: 'company'}, {name: 'organization'} ] }); grid_store = new Ext.data.GroupingStore({ proxy: new Ext.data.HttpProxy({ url: '/contacts/search_contacts/' }), reader : json_reader, sortInfo:{field: 'last_name', direction: "ASC"}, groupField:'organization' }); selectionModel = new Ext.grid.CheckboxSelectionModel(); otherSelModel = new Ext.grid.CheckboxSelectionModel(); contact_grid = new Ext.grid.EditorGridPanel({ el: 'search_results', store: grid_store, stripeRows: true, cm: new Ext.grid.ColumnModel([ selectionModel, {id:'id', dataIndex: 'id', hidden: true}, checkColumn, {header: "Already a contact?", width: 100, sortable: true, dataIndex: 'on_contact_list'}, {header: "First Name", width: 100, sortable: true, dataIndex: 'first_name'}, {header: "Last Name", width: 100, sortable: true, dataIndex: 'last_name'}, {header: "Email", width: 100, sortable: true, dataIndex: 'email'}, {header: "Office Phone", width: 100, sortable: true, dataIndex: 'work_phone'}, {header: "Organization",width: 80,sortable: true,dataIndex: 'organization'}, {header: "Company", width: 80, sortable: true, dataIndex: 'company'} ]), view: new Ext.grid.GroupingView({ forceFit:true, groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})' }), sm: otherSelModel, // inline toolbars tbar:[{ text:'Save', tooltip:'Add checked contacts to your contact list', iconCls:'add', handler : function(){ rows = contact_grid.getSelectionModel().getSelections(); contacts_to_add = [rows.length]; for(var i=0;i<rows.length;i++) { contacts_to_add[i] = rows[i].data.id; } var contactsJSON = Object.toJSON(contacts_to_add) //ajax call here } }], width:450, height:350, plugins:checkColumn, loadMask: true, title:"Contact search results", bbar: new Ext.PagingToolbar({ pageSize: 10, store: grid_store, displayInfo: true, displayMsg: 'Displaying contacts {0} - {1} of {2}', emptyMsg: "No contacts to display" }) }); contact_grid.render(); } function setup_form() { } </script> <div style="height:500px; overflow:auto"> <div id="search_input"></div> <div id="search_results"></div> </div>
-
19 Dec 2007 3:12 PM #2
-
15 Jan 2008 1:59 PM #3
I noticed it also, but I figured it out if you define the Ext.grid.CheckColumn before doing something with it you won't get this error.
Shortly - it is a matter of the position in the file - put it up.
-
17 Mar 2008 10:36 AM #4
I got the same error?How to resolve?
I got the same error?How to resolve?
I got the same error?How to resolve?
Michael Gao
-
17 Mar 2008 11:10 AM #5Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,169
- Vote Rating
- 28
Include the javascript required for that checkcolumn! Check the examples
It's not part of the core EXT suite.


Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
17 Mar 2008 11:13 AM #6Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,169
- Vote Rating
- 28
PHP Code:Ext.grid.CheckColumn = function(config){
Ext.apply(this, config);
if(!this.id){
this.id = Ext.id();
}
this.renderer = this.renderer.createDelegate(this);
};
Ext.grid.CheckColumn.prototype ={
init : function(grid){
this.grid = grid;
this.grid.on('render', function(){
var view = this.grid.getView();
view.mainBody.on('mousedown', this.onMouseDown, this);
}, this);
},
onMouseDown : function(e, t){
if(t.className && t.className.indexOf('x-grid3-cc-'+this.id) != -1){
e.stopEvent();
var index = this.grid.getView().findRowIndex(t);
var record = this.grid.store.getAt(index);
record.set(this.dataIndex, !record.data[this.dataIndex]);
}
},
renderer : function(v, p, record){
p.css += ' x-grid3-check-col-td';
return '<div class="x-grid3-check-col'+(v?'-on':'')+' x-grid3-cc-'+this.id+'"> </div>';
}
};

Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
23 Jul 2008 7:53 PM #7
checking one cell in grid
checking one cell in grid
How can i use Ext.grid.CheckColumn to check a single cell in a grid.
Can i use the geColumnModel().getSelectedCell() method inside mouseDown() method.
If use this it throws cell has no properties.
How to use this to check one cell in the grid . What are changes i need to for this.
i done like this inside mouseDown() method
please help me.Code:var index = this.grid.getView().findRowIndex(t); var fieldName = this.grid.getColumnModel().getDataIndex(index); var ind = this.grid.getColumnModel().findColumnIndex(fieldName); var record = this.grid.store.getAt(ind); record.set(ind, !record.data[ind]);Last edited by mystix; 23 Jul 2008 at 10:35 PM. Reason: post code in [code][/code] tags. refer to http://extjs.com/forum/misc.php?do=bbcode
-
23 Apr 2010 5:26 AM #8
Single Cell Selection, Copy Paste in multiple cells in same gird
Single Cell Selection, Copy Paste in multiple cells in same gird
Hi,
Even I have the same requirement
I want to develop two things in an existing tree grid of our product:
1. Single Cell Selection instead of rowselection. Copy it using Ctrl + C,
2. Multi select cells in grid, Paste the copied value using Ctrl + V
I wanted to know whether this is possible and how.
Any links or examples on this will be appreciated
Thanks in advance. Awaiting response


Reply With Quote