PDA

View Full Version : [CLOSED] Error GridPanel Internet Explorer 8



developerpr
Jul 21, 2014, 11:39 PM
Hi,
I have a problem, I have a listing gridPanel information database with current browsers there is no problem, but in Internet Explorer v8, shows an error at the time of listing. Attached image of the error.


Codigo Java Script.

function ValidaListarVehiculos() {
var txtPlaca = App.Content_Cuerpo_txtPlaca.getValue();
var txtMarca = App.Content_Cuerpo_txtMarca.getValue();
var vehiculo = {};
vehiculo.IdUnidadNegocio = App.IdUnidadNegocio.getValue();
vehiculo.Placa = txtPlaca;
vehiculo.Marca = txtMarca;
vehiculo.IdSede = App.Content_Cuerpo_cmbSede.getValue();;
var input = { "request": vehiculo };
$.support.cors = true;
$.ajax({
crossDomain: true,
cache: false,
async: true,
type: 'POST',
contentType: 'application/json;charset=utf-8',
url: URLPrincipalWebService + "/REST/Moviles.svc/ListarVehiculo ",
data: JSON.stringify(input),
dataType: 'json',
success: function (response, status, xhr) {
var myData = JSON.stringify(response);

var store = Ext.create('Ext.data.Store', {
fields: [
{ name: 'IdMovil', type: 'int' },
{ name: 'Marca', type: 'string' },
{ name: 'Modelo', type: 'string' },
{ name: 'Anio', type: 'int' },
{ name: 'Placa', type: 'string' },
{ name: 'KmMovil', type: 'int' },
{ name: 'Estado', type: 'string' },
],
data: myData
});

var grid = App.Content_Cuerpo_grdListVehiculos;
grid.getStore().loadRecords(store.getRange(0, store.getCount()), { addRecords: false });
grid.getView().refresh();
},
error: function (message) {
var jsonFault = JSON.parse(message.responseText);
Ext.Msg.alert('Error', '' + jsonFault.FaultMessage + '');
},
complete: function (jqXHR, status) { }
});

}


Codigo ASPX


<ext:GridPanel ID="grdListVehiculos"
runat="server"
DefaultAnchor="100%"
EnableColumnResize="False"
EnableColumnMove="False"
EnableColumnHide="False"
SortableColumns="False"
Frame="true">
<Store>
<ext:Store ID="StoreListVehiculos" runat="server" PageSize="10">
<Model>
<ext:Model ID="ModelListVehiculos" runat="server">
<Fields>
<ext:ModelField Name="IdMovil" Type="Int" />
<ext:ModelField Name="Marca" Type="String" />
<ext:ModelField Name="Modelo" Type="String" />
<ext:ModelField Name="Anio" Type="Int" />
<ext:ModelField Name="Placa" Type="String" />
<ext:ModelField Name="KmMovil" Type="Int" />
<ext:ModelField Name="Estado" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel3" runat="server">
<Columns>
<ext:Column ID="colMarca"
runat="server"
Text="Marca"
DataIndex="Marca"
Align="Center"
Width="80" />
<ext:Column ID="colModelo"
runat="server"
Text="Modelo"
DataIndex="Modelo"
Align="Center"
Width="80" />
<ext:Column ID="ColAnio"
runat="server"
Text="A?o"
DataIndex="Anio"
Align="Center"
Width="80" />
<ext:Column ID="ColPlaca"
runat="server"
Text="Placa"
DataIndex="Placa"
Align="Center"
Width="100" />
<ext:Column ID="colKmRecorrido"
runat="server"
Text="Km Recorrido"
DataIndex="KmMovil"
Align="Center"
Width="100" />
<ext:Column ID="colEstado"
runat="server"
Text="Estado"
DataIndex="Estado"
Align="Center"
Width="50" />
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
</SelectionModel>

</ext:GridPanel>

Daniil
Jul 22, 2014, 1:25 PM
Hi @developerpr,

I am not sure, but this might be a bottleneck.

var myData = JSON.stringify(response);

Please check the content of the "myData" variable is the same or not in IE8 and other browsers.

As for the error screenshot. I see there is the minified JavaScript. For development and debugging it is better to use non-minified JavaScript code.

Please set this setting for a ResourceManager

ScriptMode="Development"
or globally in Web.config (in the <extnet> section)

scriptMode="Development"

developerpr
Jul 22, 2014, 4:12 PM
I've solved today and actually, the problem was more than populate de gripanel. This was the solution:


IE8 needs the KB976662 patch (http://support.microsoft.com/kb/976662)., This is for correct the method JSON.stringify.
When I create a store object (the above code) I put a extra comma at the fields definition.

I put "{ name: 'Estado', type: 'string' }," . It must be without the comma at the end (I didn't respect the correct syntax) .


I hope that It can help you in this scenario.

Daniil
Jul 23, 2014, 1:16 PM
Thank you for sharing the solution.