I want to write the sums of some data under grouping and grid. I am sharing my codes, I will be glad if you help. Thank you.
var store = new Ext.data.JsonStore({
url: 'ajaxQueryData?_qid=4146',
root: 'data',
totalProperty: 'browseInfo.totalCount',
remoteSort: true,
id: 'sira_no',
sortInfo: {
field: 'sira_no',
direction: 'ASC'
},
fields: [
{
name: "sira_no",
type: "int"
},
{
name: "branch_id_qw_"
},
{
name: "firma"
},
{
name: "sevk_adres"
},
{
name: "malzeme"
},
{
name: "group_id_qw_"
},
{
name: "kategori_id_qw_"
},
{
name: "alt_kategori_id_qw_"
},
{
name: "vade"
},
{
name: "birim_tip_qw_"
},
{
name: "miktar"
},
{
name: "kg"
},
{
name: "birim_fiyat"
},
{
name: "para_birim_qw_"
},
{
name: "net_tutar"
},
{
name: "irsaliye_dt"
},
{
name: "irsaliye_no"
},
{
name: "fatura_dt"
},
{
name: "fatura_no"
},
{
name: "sehir_id_qw_"
},
{
name: "ilce_id_qw_"
},
{
name: "satis_sorumlusu_id_qw_"
}
],
pageSize: 50,
autoLoad: {
params: {
startRow: 0,
fetchCount: 50
}
}
// proxy: new Ext.data.HttpProxy({
// })
});
var grid = new Ext.grid.GridPanel({
store: store,
columns: [{
id: 'sira_no',
header: 'Sıra No',
width: 50,
sortable: true,
dataIndex: 'sira_no'
},
{
header: 'Şube',
width: 150,
sortable: true,
dataIndex: 'branch_id_qw_'
},
{
header: 'Firma',
width: 250,
sortable: true,
dataIndex: 'firma'
},
{
header: 'Sevk Adresi',
width: 150,
sortable: true,
hidden: true,
dataIndex: 'sevk_adres'
},
{
header: 'Malzeme Adı',
width: 200,
sortable: true,
hidden: true,
dataIndex: 'malzeme'
},
{
header: 'Grup',
width: 100,
sortable: true,
dataIndex: 'group_id_qw_'
},
{
header: 'Kategori',
width: 100,
sortable: true,
dataIndex: 'kategori_id_qw_'
},
{
header: 'Alt Kategori',
width: 100,
sortable: true,
dataIndex: 'alt_kategori_id_qw_'
},
{
header: 'Vade (gün)',
width: 80,
sortable: true,
dataIndex: 'vade'
},
{
header: 'Birim',
width: 50,
sortable: true,
hidden: true,
dataIndex: 'birim_tip_qw_'
},
{
header: 'Miktar',
width: 80,
sortable: true,
hidden: true,
dataIndex: 'miktar'
},
{
header: 'Kg',
width: 80,
sortable: true,
dataIndex: 'kg'
},
{
header: 'Birim Fiyat',
width: 80,
sortable: true,
dataIndex: 'birim_fiyat'
},
{
header: 'Para Birimi',
width: 50,
sortable: true,
dataIndex: 'para_birim_qw_'
},
{
header: 'Net Tutar',
width: 80,
sortable: true,
dataIndex: 'net_tutar'
},
{
header: 'İrsaliye Tarihi',
width: 100,
sortable: true,
hidden: true,
dataIndex: 'irsaliye_dt'
},
{
header: 'İrsaliye No',
width: 100,
sortable: true,
hidden: true,
dataIndex: 'irsaliye_no'
},
{
header: 'Fatura Tarihi',
width: 100,
sortable: true,
hidden: true,
dataIndex: 'fatura_dt'
},
{
header: 'Fatura No',
width: 100,
sortable: true,
hidden: true,
dataIndex: 'fatura_no'
},
{
header: 'Şehir',
width: 120,
sortable: true,
dataIndex: 'sehir_id_qw_'
},
{
header: 'İlçe',
width: 120,
sortable: true,
dataIndex: 'ilce_id_qw_'
},
{
header: 'Satış Sorumlusu',
width: 200,
sortable: true,
dataIndex: 'satis_sorumlusu_id_qw_'
}
],
viewConfig: {
forcefit: true
},
//resizable: true,
width: function() {
$("#aciklama").width();
$(document).ready(function() {
$(".slide-left").click(function() {
Width: $("#aciklama").width();
})
$(".slide-right").click(function() {
Width: $("#aciklama").width() - 334;
})
})
},
height: $("#aciklama").height(),
frame: true,
tbar: new Ext.PagingToolbar({
pageSize: 50,
store: store,
displayInfo: true
})
});
grid.render('aciklama');
Related
I have a ColumTree Ext.us.Tree.ColumnTree, I want to hide/show a column conditionally, I used config like hidden and setVisible, but it will not work,
var tree = new Ext.ux.tree.ColumnTree({
width: 990,
height: 300,
rootVisible: false,
autoScroll: true,
title: '<s:property value="lblStockTotal"/>',
renderTo: 'tree-div',
columns: [
{
id: 'lblProduct',
header: '<s:property value="lblProduct"/>'+' -> '+'<s:property value="lblProgram"/>'+' -> ' +'<s:property value="lblCountry"/>',
dataIndex: 'Product',
width: 230
},
{
header: '<s:property value="lblTotalVolume"/>',
width: 150,
dataIndex: 'TotalVolume'
},
{
header: '<s:property value="lblTradingStock"/>',
width: 150,
dataIndex: 'TradingStock'
},
{
header: '<s:property value="lblMarketplace"/>',
width: 150,
dataIndex: 'Marketplace',
hidden:true
},
{
header: '<s:property value="lblAuction"/>',
width: 150,
dataIndex: 'Auction',
hidden:true
},
{
header: '<s:property value="lblWarehouse"/>',
width: 150,
dataIndex: 'Warehouse',
hidden:true // NOT Working
}
],
loader: new Ext.tree.TreeLoader({
dataUrl: 'stocktotaldata.action',
uiProviders: {
'col': Ext.ux.tree.ColumnNodeUI
}
}),
root: new Ext.tree.AsyncTreeNode({
text: 'Tasks'
})
});
MANUAL APPROACH
What I have Done, I split up each column into variable like col1,col2 etc and now I want to render those column using if condition , which is even not work, when I add up all those column like col1+col2+col3, that will encountered an error
masterColumn=column1+column2+column3+column4+column5+column6+colEnd;
var column1=[
{
id: 'lblProduct',
header: '<s:property value="lblProduct"/>'+' -> '+'<s:property value="lblProgram"/>'+' -> ' +'<s:property value="lblCountry"/>',
dataIndex: 'Product',
width: 230
},;
var column2=
{
header: '<s:property value="lblTotalVolume"/>',
width: 150,
dataIndex: 'TotalVolume'
},;
var column3=
{
header: '<s:property value="lblTradingStock"/>',
width: 150,
dataIndex: 'TradingStock'
};
var column4=
,{
header: '<s:property value="lblMarketplace"/>',
width: 150,
dataIndex: 'Marketplace',
hidden:true
};
var column5=
,{
header: '<s:property value="lblAuction"/>',
width: 150,
dataIndex: 'Auction',
align:'right',
hidden:true,
};
var column6=
,{
header: '<s:property value="lblWarehouse"/>',
width: 150,
dataIndex: 'Warehouse',
hidden:true
};
var colEnd=];
var tree = new Ext.ux.tree.ColumnTree({
width: 990,
height: 300,
rootVisible: false,
autoScroll: true,
title: '<s:property value="lblStockTotal"/>',
renderTo: 'tree-div',
columns: masterColumn,
loader: new Ext.tree.TreeLoader({
dataUrl: 'stocktotaldata.action',
uiProviders: {
'col': Ext.ux.tree.ColumnNodeUI
}
}),
root: new Ext.tree.AsyncTreeNode({
text: 'Tasks'
})
});
var tree = new Ext.ux.tree.ColumnTree({
width: 990,
height: 300,
rootVisible: false,
autoScroll: true,
title: '<s:property value="lblStockTotal"/>',
renderTo: 'tree-div',
columns: [
this.column1 = {
id: 'lblProduct',
header: '<s:property value="lblProduct"/>'+' -> '+'<s:property value="lblProgram"/>'+' -> ' +'<s:property value="lblCountry"/>',
dataIndex: 'Product',
width: 230
},
this.column2 = {
header: '<s:property value="lblTotalVolume"/>',
width: 150,
dataIndex: 'TotalVolume'
},
this.column3 = {
header: '<s:property value="lblTradingStock"/>',
width: 150,
dataIndex: 'TradingStock'
},
this.column4 = {
header: '<s:property value="lblMarketplace"/>',
width: 150,
dataIndex: 'Marketplace',
hidden:true
},
this.column5 = {
header: '<s:property value="lblAuction"/>',
width: 150,
dataIndex: 'Auction',
hidden:true
},
this.column6 = {
header: '<s:property value="lblWarehouse"/>',
width: 150,
dataIndex: 'Warehouse',
hidden:true // NOT Working
}
],
loader: new Ext.tree.TreeLoader({
dataUrl: 'stocktotaldata.action',
uiProviders: {
'col': Ext.ux.tree.ColumnNodeUI
}
}),
root: new Ext.tree.AsyncTreeNode({
text: 'Tasks'
})
});
we can use the reference using this, and later use this reference in the instance you have created and then can use hide and show method to hide or show.
How does the 'ExtJS' column grouping work in 'EditorGridPanel'? For, in this example: 'http://dev.sencha.com/deploy/ext-4.0.0/examples/grid/group-header-grid.html', it seems like it's not really working, yet its working fine for me in 'simple grid panel'.
Ext.apply(this,
{
store: new Ext.data.Store(
{
reader: new Ext.data.JsonReader(
{
id: '"ID"',
totalProperty: 'totalCount',
root: 'rows',
fields: [
{ name: 'ID', type: 'string' },
{ name: 'organizationID', type: 'string' },
{ name: 'StructureID', type: 'string' },
{ name: 'Type', type: 'string' },
{ name: 'PropID', type: 'string' },
{ name: 'ProtectedSurface', type: 'string' },
{ name: 'Content', type: 'string' },
{ name: 'CPType', type: 'string' },
{ name: 'Location', type: 'string' },
]
}),
proxy: new Ext.data.HttpProxy({ url: this.url }),
baseParams: { cmd: 'getData1', objName: this.objName, aad: Ext.getCmp('clientidforStr').getValue() },
sortInfo: { field: '"ID"', direction: 'ASC' },
remoteSort: true,
mode: 'local',
autoLoad: true,
listeners: {
load: {
scope: this, fn: function (store) {
// keep modified records accros paging
var modified = store.getModifiedRecords();
for (var i = 0; i < modified.length; i++) {
var r = store.getById(modified[i].id);
if (r) {
var changes = modified[i].getChanges();
for (p in changes) {
if (changes.hasOwnProperty(p)) {
r.set(p, changes[p]);
}
}
}
}
//alert(Ext.getCmp('areaidforStr').getValue());
}
},
exception: function (proxy, type, action, options, response, arg) {
if (response.responseText != '') {
Ext.Msg.alert('From getData Command', response.responseText);
}
//this.showError(response.responseText, 'from getData Command:');
//alert(response.responseText + '\n from getData Command ');
console.log(response);
if (type === 'remote') {
// success is false
// do your error handling here
alert('error' + response);
console.log(response); // the response object sent from the server
}
}
}
}),
features: [{
groupHeaderTpl: 'Subject: {Location}',
ftype: 'groupingsummary'
}],
columns: [
{
header: 'ID',
id: 'ID',
dataIndex: 'ID',
hidden: true,
hideable: false,
sortable: true,
editor: new Ext.form.TextField({ allowBlank: false })
},
{
header: 'Structure Group',
id: 'StructureID',
dataIndex: 'StructureID', editable: false,
width: 45,
sortable: true,
editor: comboStructureAreaRelation,
renderer: Ext.util.Format.comboRenderer(comboStructureAreaRelation, AssignedGridStoreforStr)
},
{
header: 'Structure',
dataIndex: 'Type',
id: 'Type', editable: false,
width: 45,
sortable: true,
editor: StructureTypeCombo,
renderer: Ext.util.Format.comboRenderer(StructureTypeCombo, StorestrructureType)
},
{
header: 'Asset ID',
dataIndex: 'PropID', editable: false,
id: 'PropID',
width: 60,
sortable: true,
editor: new Ext.form.TextField({ allowBlank: false, cls:'textStyle' })
},
{
header: 'Protected Surface',
dataIndex: 'ProtectedSurface',
id: 'ProtectedSurface',
editable: false,
width: 45,
sortable: true,
editor: ComboTankProtectedSurface,
renderer: Ext.util.Format.comboRenderer(ComboTankProtectedSurface, storeTankProtectedSurface)
},
{
header: 'DATA EX',
id: 'ProtectedSurface11',
columns: [
{
header: 'Asset ID',
dataIndex: 'PropID', editable: false,
id: 'PropID11',
width: 60,
sortable: true,
editor: new Ext.form.TextField({ allowBlank: false, cls: 'textStyle' })
},
{
header: 'Protected Surface',
dataIndex: 'ProtectedSurface',
id: 'ProtectedSurface11',
editable: false,
width: 45,
sortable: true,
editor: ComboTankProtectedSurface,
renderer: Ext.util.Format.comboRenderer(ComboTankProtectedSurface, storeTankProtectedSurface)
},
]
},
{
header: 'Content',
dataIndex: 'Content', editable: false,
id: 'Content',
width: 60,
sortable: true,
},
{
header: 'CP Type',
dataIndex: 'CPType', editable: false,
id: 'CPType',
width: 60,
sortable: true,
},
{
header: 'Location',
dataIndex: 'Location', editable: false,
id: 'Location',
width: 60,
sortable: true,
},
I have an EditorGridPanel which includes some columns but i want to change its type one of them to editor according to some values.
My column is below:
header: dil('Fiyat'),
width: 30,
sortable: true,
renderer: Ext.util.Format.numberRenderer('$0.000,00/i'),
dataIndex: 'fiyat'
but after changes, i want to work like:
header: dil('Fiyat'),
width: 30,
sortable: true,
renderer: Ext.util.Format.numberRenderer('$0.000,00/i'),
dataIndex: 'fiyat'
editor: new Ext.form.NumberField({
enableKeyEvents : true,
allowBlank: false,
allowNegative: false,
style: 'text-align:left'
})
My entire code:
var po_combolu_toolbar2 = new Ext.Toolbar({
items: [
new Ext.form.ComboBox({
id: 'po_combo_id',
hiddenName: 'po_combo_hid',
name: 'po_combo_name',
store: PoTipStore,
valueField: 'id',
displayField: 'isim',
typeAhead: true,
triggerAction: 'all',
emptyText: dil('Tip Seçiniz'),
selectOnFocus: true,
anchor: '100%',
listeners: {
select: {
fn: function (combo, value) {
var modelCmp = Ext.getCmp('po_combo_id').getValue();
po_siparis_grid.store.setBaseParam("secim", modelCmp);
if (Ext.getCmp('po_combo_id').getValue() == 5) {
} else {
}
po_siparis_grid.store.load();
}
}
},
allowBlank: true
})]
});
var po_siparis_grid = new xg.EditorGridPanel({
sm: new Ext.grid.RowSelectionModel({
singleSelect: true
}),
ds: new Ext.data.GroupingStore({
reader: po_siparis_reader,
writer: po_siparis_writer,
autoSave: false,
baseParams: {
type: 'POSiparis'
},
proxy: new Ext.data.HttpProxy({
api: {
read: {
url: 'phps/POSiparisGetir.php?lang=dil(lang)',
method: 'POST'
},
create: 'app.php/users/create',
update: 'phps/POKayit.php?lang=dil(lang)',
destroy: {
url: 'app.php/users/destroy',
method: "DELETE"
}
}
}),
sortInfo: {
field: 'id',
direction: 'ASC'
},
listeners: {
save: function (store, batch, data) {
Ext.Msg.alert(dil('Mesaj'), dil('Kayıt Yapıldı.Teşekkürler.'));
window.bolgesel.siparisler.genel.mnt.dataStoreUpdate = 0;
},
update: function () {
window.bolgesel.siparisler.genel.mnt.dataStoreUpdate = 1;
}
},
groupField: 'grup'
}),
columns: [{
header: dil('Grup '),
width: 20,
sortable: true,
dataIndex: 'grup'
}, {
header: dil('Item No'),
width: 20,
sortable: true,
dataIndex: 'item_no'
}, {
header: dil('Kod'),
width: 40,
sortable: true,
dataIndex: 'code'
}, {
header: dil('Açıklama'),
sortable: true,
dataIndex: 'aciklama'
}, {
header: dil('Fiyat'),
id: "fiyat_column",
width: 30,
sortable: true,
renderer: Ext.util.Format.numberRenderer('$0.000,00/i'),
dataIndex: 'fiyat'
}, {
id: "tipikeadet",
header: dil('Adet'),
width: 30,
sortable: true,
dataIndex: 'adet',
editor: new Ext.form.NumberField({
enableKeyEvents: true,
allowBlank: false,
allowNegative: false,
style: 'text-align:left'
})
}, {
header: dil('Toplam'),
width: 30,
sortable: true,
renderer: function (v, params, record) {
return Ext.util.Format.number(record.data.fiyat * record.data.adet, '$0.000,00/i');
},
dataIndex: 'toplam',
summaryType: 'totalCost',
summaryRenderer: Ext.util.Format.numberRenderer('$0.000,00/i')
}],
view: new Ext.grid.GroupingView({
forceFit: true,
showGroupName: false,
enableNoGroups: false,
enableGroupingMenu: false,
hideGroupedColumn: true,
startCollapsed: true
}),
plugins: summary,
frame: true,
width: 800,
height: 250,
clicksToEdit: 1,
collapsible: false,
animCollapse: false,
trackMouseOver: false,
enableColumnMove: false,
iconCls: 'siparis'
});
I want to change the fiyat column speficitation in the po_combolu_toolbar2 select function.
I have a grid in ExtJS 3.4 but it will not sort. I am getting this error in firebug when clicking on a column header:
invalid Array.prototype.sort argument
Line 48523
How do I fix it?
Here is the store, column, and grid definition:
function AircraftFeesStore() {
return new Ext.data.JsonStore(Ext.apply({
url: AVRMS.ROOT_CONTEXT + "/ssl/json/general/GetAircraftFees.aspx",
idProperty: 'AircraftOid',
baseParams: {
OwnerOid: 0,
SelectedAircraft: ''
},
fields: ['AircraftOid','NNumber', 'Make', 'Model', 'RegistrationFeeFormatted']
}));
}
var colModel = new Ext.grid.ColumnModel([
{ id: 'AircraftOid', width: 100, sortable: true, locked: true, hidden: true, dataIndex: 'AircraftOid' },
{ header: "N-Number", width: 100, sortable: true, hidden: true, dataIndex: 'NNumber' },
{ header: "Make", width: 250, sortable: true, hideable: false, dataIndex: 'Make' },
{ header: "Model", width: 250, sortable: true, hideable: false, dataIndex: 'Model' },
{ header: "Registration Fee", width: 150, sortable: true, hideable: false, dataIndex: 'RegistrationFeeFormatted' }
]);
var registrationGrid = new Ext.grid.GridPanel(
{
store: aircraftFeesStore,
cm: colModel,
sm: new Ext.grid.RowSelectionModel({ singleSelect: true }),
viewConfig: {
forceFit: true
},
width: 970,
height: 150,
split: true,
region: 'north',
frame: true,
title: 'Selected Aircraft with Total'
});
Try giving
remoteSort:true
in your grid
I am using extjs grid, and I have a jQuery timer, which will call RenderGrid function every 20 seconds. I want to show mask for grid each timer tick. Please advise.
function RenderGrid(dataObj) {
var jasonContent = JSON.parse(dataObj)
if (document.getElementById('panel').innerHTML != '') {
document.getElementById('panel').innerHTML = '';
}
var myData = {
records: jasonContent
};
var fields = [
{ name: 'Position_ID', mapping: 'Position_ID' },
{ name: 'PriorityCount', mapping: 'PriorityCount' },
{ name: 'MyCheckBox', mapping: 'MyCheckBox' },
{ name: 'Veh_Plateno', mapping: 'Veh_Plateno' },
{ name: 'Drv_Firstname', mapping: 'Drv_Firstname' },
{ name: 'GPSTimeAsString', mapping: 'GPSTimeAsString' },
{ name: 'Speed', mapping: 'Speed' },
{ name: 'SubFleet_Name', mapping: 'SubFleet_Name' }
];
var gridStore = new Ext.data.JsonStore({
fields: fields,
data: myData,
root: 'records'
});
var cols = [
{ id: 'Position_ID', header: "Position_ID", width: 160, sortable: true, dataIndex: 'Position_ID', hidden: true, hideable: false },
{ header: "", width: 30, sortable: false, dataIndex: 'MyCheckBox', renderer: renderCheckBox, hideable: false, menuDisabled: true },
{ header: "", width: 30, sortable: false, dataIndex: 'PriorityCount', renderer: renderIcon, hideable: false, menuDisabled: true },
{ header: "Veh_Plateno", width: 100, sortable: true, dataIndex: 'Veh_Plateno' },
{ header: "Drv_Firstname", width: 100, sortable: true, dataIndex: 'Drv_Firstname' },
{ header: "GPSTime", width: 100, sortable: true, dataIndex: 'GPSTimeAsString' },
{ header: "Speed", width: 100, sortable: true, dataIndex: 'Speed' },
{ header: "SubFleet_Name", width: 100, sortable: true, dataIndex: 'SubFleet_Name' }
];
gridStore.setDefaultSort('Veh_Plateno', 'asc');
var grid = new Ext.grid.GridPanel({
ddGroup: 'gridDDGroup',
store: gridStore,
renderTo: 'panel',
columns: cols,
enableDragDrop: true,
stripeRows: true,
pageSize:25,
header: false,
loadMask: true,
autoExpandColumn: 'Position_ID',
width: 900,
height: 325,
region: 'west',
title: 'Data Grid',
selModel: new Ext.grid.RowSelectionModel({ singleSelect: false }),
listeners: {
'rowdblclick': function (grid, rowIndex, e) {
var rec = grid.getStore().getAt(rowIndex);
var columnName = grid.getColumnModel().getDataIndex(2);
Ext.MessageBox.alert('', rec.get(columnName));
// do something
}
}
});
//grid.getEl().mask();
//grid.store.reload();
//grid.getEl().unmask();
//gridStore.load({ params: { start:0, limit: 25} });
/// grid.loadMask.show();
grid = null;
cols = null;
fields = null;
gridStore = null;
myData = null;
}
thaks man this approch working fine with me but now my browser is hanging it seems, grid object will enter in infinite loop this all my script code, please prvide me example with timer if you can :
var grid = null;
function RenderPositionsGrid(dataObj) {
var jasonContent = JSON.parse(dataObj)
var myData = {
records: jasonContent
};
if (grid == null) {
var fields = [
{ name: 'Position_ID', mapping: 'Position_ID' },
{ name: 'PriorityCount', mapping: 'PriorityCount' },
{ name: 'MyCheckBox', mapping: 'MyCheckBox' },
{ name: 'Veh_Plateno', mapping: 'Veh_Plateno' },
{ name: 'Drv_Firstname', mapping: 'Drv_Firstname' },
{ name: 'GPSTimeAsString', mapping: 'GPSTimeAsString' },
{ name: 'Speed', mapping: 'Speed' },
{ name: 'SubFleet_Name', mapping: 'SubFleet_Name' }
];
var gridStore = new Ext.data.JsonStore({
fields: fields,
data: myData,
root: 'records'
});
var cols = [
{ id: 'Position_ID', header: "Position_ID", width: 160, sortable: true, dataIndex: 'Position_ID', hidden: true, hideable: false },
{ header: "", width: 30, sortable: false, dataIndex: 'MyCheckBox', renderer: renderCheckBox, hideable: false, menuDisabled: true },
{ header: "", width: 30, sortable: false, dataIndex: 'PriorityCount', renderer: renderIcon, hideable: false, menuDisabled: true },
{ header: "Veh_Plateno", width: 100, sortable: true, dataIndex: 'Veh_Plateno' },
{ header: "Drv_Firstname", width: 100, sortable: true, dataIndex: 'Drv_Firstname' },
{ header: "GPSTime", width: 100, sortable: true, dataIndex: 'GPSTimeAsString' },
{ header: "Speed", width: 100, sortable: true, dataIndex: 'Speed' },
{ header: "SubFleet_Name", width: 100, sortable: true, dataIndex: 'SubFleet_Name' }
];
gridStore.setDefaultSort('Veh_Plateno', 'asc');
grid = new Ext.grid.GridPanel({
ddGroup: 'gridDDGroup',
store: gridStore,
renderTo: 'panel',
columns: cols,
enableDragDrop: true,
stripeRows: true,
pageSize: 25,
header: false,
loadMask: true,
autoExpandColumn: 'Position_ID',
width: 900,
height: 325,
region: 'west',
title: 'Data Grid',
selModel: new Ext.grid.RowSelectionModel({ singleSelect: false }),
listeners: {
'rowdblclick': function (grid, rowIndex, e) {
var rec = grid.getStore().getAt(rowIndex);
var columnName = grid.getColumnModel().getDataIndex(2);
Ext.MessageBox.alert('', rec.get(columnName));
// do something
}
}
});
}
else {
grid.store.loadData(myData);
}
}
function renderIcon(val) {
if (val) {
val = '../images/grid/icon_warning.png';
return "<img class=Blink src='" + val + "'>";
}
}
function renderCheckBox(val, cell, record) {
var x = '<input onclick="alert(' + cell.id + ')" type="checkbox" name="mycheckbox" />';
//var x = '<input type="checkbox" name="mycheckbox" />';
return x;
}
function renderDate(date) {
alert(date);
return date.format("d.m.Y");
}
function BindGridView() {
Data.GetVehiclePositions(onSuccess, onFail, null);
}
function onSuccess(result) {
RenderPositionsGrid(result);
var timeout = 4000; var timer;
timer = $.timer(timeout, function () { BindGridView(result); });
}
function onFail(result) {
alert("fail");
}
function blink() {
$('.Blink').delay(100).fadeTo(200, 0.5).delay(200).fadeTo(100, 1, blink);
}
Ext.onReady(function () {
BindGridView();
blink();
});
You could use
var myMask = new Ext.LoadMask(grid.getEl(), {msg:"Please wait..."});
myMask.show();
But I find your approach kind of weird, seems like the only thing changing every 20 seconds is your dada, your store, column model, grid never changed.
Can you just do a simple loadData(Object data, [Boolean append] ) in your timer handler? the API is here