PDA

View Full Version : Error onColumnMove



leon945
6 Sep 2007, 2:04 PM
Hi everyone..

I'm just starting to get to know ext, so bare with me...

I created a grid, and when i try to move the columns it gives me this error in the normal explorer debugger (im using IE6):

Array length must be assigned a finite positive number
And it doesnt move the column (of course).

this is my WHOLE js file, i give you the whole thing because im working on an existing environment which loads page contents via AJAX, so you have an idea on how it works and what the problem might be:
[CODE]
function rhfxx9900() {
var url = 'rhxx9900gd.html';
var param = 'pUsuario=' + gv_cIdUsuario;

var callback = proc_rhfxx9900;
guiShowDiv('loading', true);
ajxGetURLAsync(url,param,callback);
}

function proc_rhfxx9900() {
if (oXmlHttp.readyState == 4)
if (oXmlHttp.status == 200) {
gv_oContent.innerHTML = oXmlHttp.responseText;
makeGrid();
guiShowDiv('loading', false);
}
}

function makeGrid(){
Ext.onReady(function(){

//create a button
var btn = new Ext.Button("button",{text:"Refresh Grid"});

// create the Data Store
var ds = new Ext.data.Store({
// load using HTTP
proxy: new Ext.data.HttpProxy({url: 'rhxx9900gr.p?pNumReg=0'}),

// the return will be XML, so lets set up a reader
reader: new Ext.data.XmlReader({
// records will have a "PLANTA" tag
record: 'PLANTA',
id: 'idplanta',
totalRecords: 'totalRegistros'
}, [
//definicion de registro
{name:'numero',type:'int'}, {name:'idplanta',type:'string'}, {name:'nombre',type:'string'},{name:'distrito',type:'string'}
])
});

var cm = new Ext.grid.ColumnModel([
{header: "#", width: 30, dataIndex: 'numero', align:'right'},
{header: "Planta", width: 120, dataIndex: 'idplanta', align:'right'},
{header: "Nombre", width: 300, dataIndex: 'nombre', align:'left'},
{header: "Distrito", width: 120, dataIndex: 'distrito', align:'right'}
]);
cm.defaultSortable = true;

// create the grid
var grid = new Ext.grid.Grid('gridContainer', {
ds: ds,
cm: cm,
autoExpandColumn:cm.getColumnId(2),
//enableColumnMove:false,
maxHeight:300
});
grid.render();

ds.load();

btn.on("click",function(){
// Basic alert:
Ext.Msg.alert('Mensaje', 'Entro a la funci