PDA

View Full Version : how to insert a row into group-summary-grid



ma1986
22 Aug 2011, 10:50 PM
I insert some code for adding a "insert button" in the group-summary-grid.js.
tbar: [{
text: 'Add',
handler : function(){
// Create a record instance through the ModelManager
var r = Ext.ModelManager.create({
project:'',
due:'',
estimate: '',
rate: '',
cost:''
}, 'Task');
grid.store.insert(0, r);

}
}],
but have a erro :
me.summaryGroups[index - 1] is undefined
anyone can help me thank you!

salvocanna
9 Sep 2011, 7:16 AM
I've the same issue!!!!
Please can anyone help?!

Thank you!

salvocanna
11 Sep 2011, 1:13 AM
For anyone who have this problem
groupsummary gives error when it doesn't know in which group put the new row
I've solved with try catch and finally statement ....

something like:

in the store:

...
create: 'mypage.php?action=create_new_row'
...




handler : function(){
try {


var r = Ext.ModelManager.create({
project:'',
due:'',
estimate: '',
rate: '',
cost:''
}, 'Task');

grid.store.insert(0, r);


} catch (e) {


Ext.Ajax.request({ url : 'mypage.php?action=create_new_row',
method: 'POST',
success: function ( result, request ) {
grid.store.load();
},
failure: function ( result, request ) {
grid.store.load();
}
});


} finally {
}

}


I do not know if it's the best way to do this, but it works...

Ooypunk
1 Oct 2011, 6:10 AM
No, it's not the best way: in this way you're bypassing all that makes ExtJS so usefull.

Unfortunately, as I see no other options, I think I'll go with this. And meanwhile post this as a bug, so maybe then it will get the attention of the programmers.

Edit: I changed ftype: 'groupingsummary' into ftype: 'grouping' and it works now, so I'm not going to post the bug.

Mcaveti
25 Apr 2012, 11:04 PM
Ext.override(Ext.grid.feature.GroupingSummary, {
getPrintData: function (index) {
var me = this,
columns = me.view.headerCt.getColumnsForTpl(),
i = 0,
length = columns.length,
data = []

if ( !me.summaryGroups[index - 1] ) me.getFragmentTpl() //fix

var name = me.summaryGroups[index - 1].name,
active = me.summaryData[name],
column;
for (; i < length; ++i) {
column = columns[i];
column.gridSummaryValue = this.getColumnValue(column, active);
data.push(column);
}
return data;
}
}

geek0r
23 May 2012, 2:46 AM
Thanx for the fix! Works like a charm ... Have you posted this so it can be "merged" into some future release?

Mcaveti
23 May 2012, 7:05 AM
Thanx for the fix! Works like a charm ... Have you posted this so it can be "merged" into some future release?
Enjoy! I do not know, I'm not the developer of the Ext JS