PDA

View Full Version : Grid problems with IE



Thylia
27 Apr 2007, 2:06 AM
Hello,

the code below functions with Firefox but not under IE. The request is well called but information does not appear in the grid.


var GridCrt = function(){
var grid, sm, ds, cm;
var menuContextTpt = new Ext.menu.Menu('mainContextTpt');

return {
init : function( ){
var Tpt = Ext.data.Record.create([
{name:'RefTpt' , mapping:'RefTpt' },
{name:'Prty' , mapping:'Prty' },
{name:'EtatTrs', mapping:'EtatTrs'},
{name:'RangTrs', mapping:'RangTrs'},
{name:'RangTpt', mapping:'RangTpt'},
{name:'Matos' , mapping:'Matos' },
{name:'ChgMode', mapping:'ChgMode'},
{name:'Partics', mapping:'Partics'},
{name:'IObserv', mapping:'IObserv'},
{name:'TypDti' , mapping:'TypDti' },
{name:'DateDep', mapping:'DateDep'},
{name:'DatePar', mapping:'DatePar'},
{name:'SrvDep' , mapping:'SrvDep' },
{name:'CoulDep', mapping:'CoulDep'},
{name:'DateArr', mapping:'DateArr'},
{name:'SrvArr' , mapping:'SrvArr' },
{name:'CoulArr', mapping:'CoulArr'},
{name:'DateRdv', mapping:'DateRdv'},
{name:'Ident' , mapping:'Ident' },
{name:'IsoBMR' , mapping:'IsoBMR' },
{name:'Contag' , mapping:'Contag' },
{name:'ModTpt' , mapping:'ModTpt' },
{name:'CodRes' , mapping:'CodRes' },
{name:'CodEmp1', mapping:'CodEmp1'},
{name:'CodEmp2', mapping:'CodEmp2'},
{name:'CodVeh' , mapping:'CodVeh' },
{name:'CodRad' , mapping:'CodRad' },
{name:'CodBip' , mapping:'CodBip' },
{name:'CodSte' , mapping:'CodSte' },
{name:'tDepl' , mapping:'tDepl' },
{name:'Act' , mapping:'Act' },
{name:'Acts' , mapping:'Acts' }
]);

var reader = new Ext.data.JsonReader({
root:'LstTpt',
totalProperty:'NbTpt',
id:'RefTpt'
},
Tpt
);

// create the Data Store
ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: 'get-lst.php'}),
reader: reader
// turn on remote sorting
// remoteSort: true
// params:{start:0, limit:25,'Lst':'Crt','Acts':Acts,'DateTpt':DateTpt}
});
// ds.setDefaultSort('CodRes', 'asc');

// pluggable renders
function renderEtatTrs(value, p, record){
var etatTrs = '', rangTrs = '';
if ( record.data['CodRes'] != '' && record.data['RangTrs'] != 0 )
{
if ( record.data['EtatTrs'] == ' ' ) etatTrs = "♠";
else etatTrs = record.data['EtatTrs'];
if ( parseInt(record.data['RangTrs']) >= 10 ) rangTrs = '*';
else rangTrs = record.data['RangTrs'];
return String.format('{0}<span style="color:{1};">{2}</span>', etatTrs, (parseInt(record.data['RangTrs']) == 1 ? "green" : "olive"), rangTrs);
}
else
return String.format('{0}', record.data['Prty']);
}

// now we create the Grid Columns
cm = new Ext.grid.ColumnModel([
{header:'No' , renderer:renderEtatTrs, width: 25, locked: true },
{header:'Heure' , renderer:renderRangTpt, dataIndex:'DateDep', width: 40 },
{header:'DEPART' , renderer:renderSrv , dataIndex:'SrvDep' , width: 85 },
{header:'Heure' , renderer:renderRangTpt, dataIndex:'DateArr', width: 40 },
{header:'ARRIVEE' , renderer:renderSrv , dataIndex:'SrvArr' , width: 85 },
{header:'H. Rdv' , renderer:renderRangTpt, dataIndex:'DateRdv', width: 40 },
{header:'Nom du Patient', renderer:renderRangTpt, dataIndex:'Ident' , width: 170},
{header:'I' , renderer:renderContag , width: 20, tooltip: 'Niveau d\'isolement' },
{header:'M' , renderer:renderMod , width: 20, tooltip: 'Mode de transport' },
{header:'P' , renderer:renderPartic , width: 40 },
{header:'Res' , dataIndex:'CodRes' , width: 60 },
{header:'Emp1' , dataIndex:'CodEmp1', width: 60 },
{header:'Emp2' , dataIndex:'CodEmp2', width: 60 },
{header:'Rad' , dataIndex:'CodRad' , width: 60 },
{header:'Veh' , dataIndex:'CodVeh' , width: 60 }
]);
// by default columns are sortable
cm.defaultSortable = true;

// sm = new Ext.grid.RowSelectionModel({singleSelect:true});
sm = new Ext.grid.RowSelectionModel();

// create the editor grid
grid = new Ext.grid.Grid('gCrt', {
ds: ds,
cm: cm,
sm: sm,
// ddGroup: 'lstDD',
enableDragDrop: true,
autoWidth: true
});

// render the Grid
grid.render();

grid.on('dblclick', this.showDemande, this);
grid.on('contextmenu', this.showContextMenu, this);

return grid;
},

showDemande : function( e ){
var dataRow = sm.getSelected();
Index.newTabHaut(dataRow.data.Ident,"DemandeI.html");
},

showContextMenu : function( e ){
// alert ( ds.data.items[0].data['TypDti'] );
e.stopEvent();
var dataRow = sm.getSelected();
if ( typeof dataRow == "undefined" || dataRow === null ) return;
menuContextTpt.removeAll();
menuContextTpt.add({text: 'Affecter le transport', handler: this.showAffectation });
menuContextTpt.add({text: 'Afficher la demande' , handler: this.showDemande });
menuContextTpt.showAt(e.xy);
},

showAffectation : function( e ){
var dataRow = sm.getSelected();
Affect.showDialog(dataRow.data);
},

refresh : function( Acts, DateTpt ){
if ( !Acts ) Acts = Index.Acts ;
if ( !DateTpt ) DateTpt = Index.DateTpt;
// ds.load({params:{start:0, limit:25,'Lst':'Crt','Acts':Acts,'DateTpt':DateTpt}});
ds.load({params:{'Lst':'Crt','Acts':Acts,'DateTpt':DateTpt}});
grid.getView().refresh();
}
};
}();


Thx

Rapha