PDA

View Full Version : reload Ext.ux.maximgb.tg.EditorGridPanel .



treblereel
30 Jun 2010, 7:49 AM
First of all, thanks for that great ux. its cool

i have problem, cant find howto reload grid ?
timesheetGrid.getView().refresh(); or timesheetStore.reload({params:{ user_id:'2',date: currDate}}); does not work :-|
all that i see is json answer
Plz help






var timesheetStore = new Ext.ux.maximgb.tg.AdjacencyListStore({
// autoLoad : true,
baseParams: {
user_id: '1',
date: currDate,
},
id: 'timesheetStoreId',
listeners: {
'beforeexpandnode': function(n,e) {
if(Ext.getCmp('jobDetailIdFieldId').getValue() == e.json._id ){
console.log('nothing to change');
}else{
Ext.Ajax.request({
url: '<?php echo base_url();?>job/getJobDetails_fake',
params: {
user_id: '1',
date: currDate,
nodeid: e.json._id,
},
success:function(response){

}
});

}
}},
url: '<?php echo base_url();?>hour/hour_json',
method:'GET',

reader: new Ext.data.JsonReader(
{
id: '_id',
root: 'data',
user_id: '1',

totalProperty: 'total',
successProperty: 'success'
},
record
)
});

var timesheetGrid = new Ext.ux.maximgb.tg.EditorGridPanel({
id: 'timesheetGridId',
enableCtxMenu: false, // turn off header context menu
enableColLock: false, // turn off column lock context items
enableColumnMove: false, // turn off column reorder drag drop
enableColumnResize: false, // turn off column resize for whole grid
enableRowHeightSync: true, // turn ON sync of locked and non locked row heights
enableColumnHide:false,
store: timesheetStore,
height: 560,
width: 860,
master_column_id : 'job',
columnLines: true,
listeners: {
beforerender: function(){ holidays.load();
timesheetStore.load();
timesheetStore.reload();

},


cellclick: function(grid, rowIndex, columnIndex, e){
timesheetGridCellEdit(grid, rowIndex, columnIndex, e);
},

beforeedit: function(){
},
beforerefresh: function(){
alert('refresh');
},

afterEdit: function(e){
console.log(e.originalValue);
console.log(e.value);
}
},
columns: [
{id:'job',header: "Job name", width: 360, sortable: true, dataIndex: 'job'},
{id:'1',header: "1", width: 20, sortable: false, dataIndex: '1',renderer:hourGridRenderer},
{id:'2',header: "2", width: 20, sortable: false, dataIndex: '2', renderer:hourGridRenderer},
{id:'3',header: "3", width: 20, sortable: false, dataIndex: '3',renderer:hourGridRenderer},
{id:'4',header: "4", width: 20, sortable: false, dataIndex: '4',renderer: hourGridRenderer },
{id:'5',header: "5", width: 20, sortable: false, dataIndex: '5',renderer: hourGridRenderer },
{id:'6',header: "6", width: 20, sortable: false, dataIndex: '6',renderer: hourGridRenderer },
{id:'7',header: "7", width: 20, sortable: false, dataIndex: '7',renderer:hourGridRenderer},
{id:'8',header: "8", width: 20, sortable: false, dataIndex: '8',renderer:hourGridRenderer},
{id:'9',header: "9", width: 20, sortable: false, dataIndex: '9',renderer:hourGridRenderer},
{id:'10',header: "10", width: 20, sortable: false, dataIndex: '10',renderer:hourGridRenderer},
{id:'11',header: "11", width: 20, sortable: false, dataIndex: '11',renderer:hourGridRenderer},
{id:'12',header: "12", width: 20, sortable: false, dataIndex: '12',renderer:hourGridRenderer},
{id:'13',header: "13", width: 20, sortable: false, dataIndex: '13',renderer:hourGridRenderer},
{id:'14',header: "14", width: 20, sortable: false, dataIndex: '14',renderer:hourGridRenderer},
{id:'15',header: "15", width: 20, sortable: false, dataIndex: '15',renderer:hourGridRenderer},
{id:'16',header: "16", width: 20, sortable: false, dataIndex: '16',renderer:hourGridRenderer},
{id:'17',header: "17", width: 20, sortable: false, dataIndex: '17',renderer:hourGridRenderer},
{id:'18',header: "18", width: 20, sortable: false, dataIndex: '18',renderer:hourGridRenderer},
{id:'19',header: "19", width: 20, sortable: false, dataIndex: '19',renderer:hourGridRenderer},
{id:'20',header: "20", width: 20, sortable: false, dataIndex: '20',renderer:hourGridRenderer},
{id:'21',header: "21", width: 20, sortable: false, dataIndex: '21',renderer:hourGridRenderer},
{id:'22',header: "22", width: 20, sortable: false, dataIndex: '22',renderer:hourGridRenderer},
{id:'23',header: "23", width: 20, sortable: false, dataIndex: '23',renderer:hourGridRenderer},
{id:'24',header: "24", width: 20, sortable: false, dataIndex: '24',renderer:hourGridRenderer},
{id:'25',header: "25", width: 20, sortable: false, dataIndex: '25',renderer:hourGridRenderer},
{id:'26',header: "26", width: 20, sortable: false, dataIndex: '26',renderer:hourGridRenderer},
{id:'27',header: "27", width: 20, sortable: false, dataIndex: '27',renderer:hourGridRenderer},
{id:'28',header: "28", width: 20, sortable: false, dataIndex: '28',renderer:hourGridRenderer},
{id:'29',header: "29", width: 20, sortable: false, dataIndex: '29',renderer:hourGridRenderer},
{id:'30',header: "30", width: 20, sortable: false, dataIndex: '30',renderer:hourGridRenderer},
{id:'31',header: "31", width: 20, sortable: false, dataIndex: '31',renderer:hourGridRenderer},
{id:'summ',header: "summ", width: 30, sortable: true, dataIndex: 'summ',menuDisabled: false},


],
stripeRows: true,
autoExpandColumn: 'job',
title: 'Timesheet ',
tbar: ['Company:',{ text: 'Ramboll', width: 55,},'-'
,'Employer:',{ text: 'Administrator', width: 125,},'-'
,'BR:',{ text: '0.8', width: 25},'-'
,'Ftee:',{ text: '0.8', width: 25},'-'
,'->','-'
,{
width: 80,
xtype: 'datefield',
id: 'dtMonth',
value: 'zero',
fieldLabel: 'Choose month',
plugins: 'monthPickerPlugin',
format: 'm/Y',
editable: false,
listeners: { select: function(){
var holder = Ext.getCmp('dtMonth');

currDate = holder.getRawValue();



// timesheetGrid.getView().refresh();


timesheetStore.reload({params:{ user_id:'2',date: currDate}});
console.log(timesheetStore);
// timesheetGrid.getView().refresh();


}}
}




,'-'
,{ width: 25,icon: '<?php echo base_url();?>images/icons/printer.png',handler: function(){ }}
],
});

4 Jul 2010, 12:05 PM
try timesheetStore.load()