PDA

View Full Version : Event to identfy row population complete for editable grid



shiby.niju
16 Jun 2010, 4:14 AM
Hi,

How can I know if all the rows in the grid is completed population?

Actually what I want is to set focus on the first editable field in the grid.

As i understand, this can be done only after the grid is completely rendered with the rows as well.

Please help me with this.

Thanks in advance.
Regards,
Shiby

pavanextjs
16 Jun 2010, 8:43 AM
Try this...


grid.getStore().on('load', function(store, records, options){
grid.startEditing(row, col);
});you might need to find the col programatically and row will 0 if you want to highlight the cell in first row.

Animal
16 Jun 2010, 9:44 AM
viewready

shiby.niju
16 Jun 2010, 10:15 PM
Hi,

Thanks for the response.

I am actually trying out the samples included in the extjs distribution.
In the simple Editor Grid example, the XML data is not getting loaded initially?
How to do that as well ?

I tried the code that you send me in the sample. But the load event itself is not getting fired.
I tired that same in the Array Grid sample as well.
What can I do about this now ?

Thanks in advance for any help.

Animal
16 Jun 2010, 11:41 PM
Again,

viewready

shiby.niju
17 Jun 2010, 2:27 AM
hi,

sorry I missed your reply.
I tried the viewready event too..
but that is also not working.

:(

Animal
17 Jun 2010, 2:30 AM
In what way not working? It's in use for this very purpose by many people.

That's the main reason why it was introduced in the last release: So that people can automatically select the first row as soon as the first row is available.

shiby.niju
17 Jun 2010, 2:47 AM
Hi,

I am using ext js version 3.0.0. Doesnt this version has the events ?
and this is my code:
/*************************************************/
grid.on({
'render':{
fn: function(grid){
alert('grid rendered >> ' + grid.rendered)
},
scope:this
}, 'viewready':{
fn: function(grid){
alert('grid ready for view >> ')
},
scope:this
}
})

grid.getStore().on('load', function(store, records, options){
alert('store.load ')
grid.startEditing(0, 0);
}
/**********************************************/

Only 'grid rendered >> true' is coming as alert.
None of the other alerts are coming.

If needed will post the entire code. But i havent made any change in the original code.

shiby.niju
17 Jun 2010, 3:35 AM
Hi,

I am using ext js version 3.1
Hope the events are there in this version.

The code snippet is given below:
/***************************************************/
grid.on({
'render':{
fn: function(grid){
alert('grid rendered >> ' + grid.rendered)
},
scope:this
}, 'viewready':{
fn: function(grid){
alert('grid ready for view >> ')
},
scope:this
}
})

grid.getStore().on('load', function(store, records, options){
alert('store.load ')
grid.startEditing(0, 0);
});
/**************************************************/

Not many changes have been done for the sample.

When I run the html, i get only 'grid rendered >> true' as alert. None of the alerts are coming.

So what to do now?
If needed will post the entire code.

Animal
7 Jul 2010, 1:12 AM
How have you debugged?

And putting alert calls in your code does NOT count as debugging.

shiby.niju
7 Jul 2010, 1:22 AM
I tired debugging, but i didnt get a clue of it ..
Can you please help me in anyway ?

Animal
7 Jul 2010, 1:45 AM
Does Firebug show errors?

Is the Store being loaded?

Does your GridView class fire the viewready event? You can set a break in the GridView class. Look at the code.

Condor
7 Jul 2010, 1:49 AM
The 'viewready' event was added somewhere during Ext 3.1.x (it's in Ext 3.1.2).

If you have an Ext version that doesn't have the viewready event then you can do the same with:

viewConfig: {
afterRender: function(){
this.constructor.prototype.afterRender.apply(this, arguments);
// your code here
}
}

shiby.niju
7 Jul 2010, 2:25 AM
Thanks for all responses.
I am referring to the sample edit-grid.html in the distribution.
The store on load event is also not getting fired and no data is being pulled from the XML input in the onload. Adding new rows is working fine.

Where should i give this code ?

Condor
7 Jul 2010, 2:28 AM
You need to publish the examples on a HTTP server; they won't work on the local filesystem!

shiby.niju
7 Jul 2010, 3:55 AM
Hi,

thanks for that suggestion.. I moved it a server and I got the xml data on load... but still the grid.render event is not being fired..
following is the code:
// create the editor grid
var grid = new Ext.grid.EditorGridPanel({
....
}

grid.on({
'render':{
fn: function(grid){
alert('grid rendered');
//grid.getStore().load();
},
scope:this
}, 'viewready':{
fn: function(grid){
alert('grid ready for view >> ')
},
scope:this
}
})
// trigger the data store load
store.load();

Elijah
12 Jul 2010, 6:39 AM
Please format the CODE


// create the editor grid
var grid = new Ext.grid.EditorGridPanel({
....
}

grid.on({
'render':{
fn: function(grid){
alert('grid rendered');
//grid.getStore().load();
},
scope:this
},
'viewready':{
fn: function(grid){
alert('grid ready for view >> ')
},
scope:this
}
})

// trigger the data store load
store.load();