当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - How to mantain filter row when sortable option is set to true in jqgrid?

问题描述:

Im using JQgrid with sortable option set to true and filter toolbar. The problem is that when i change a column order, the filter toolbar maintains the original position.

Example:

I have 2 columns: ID, Name

I change the place and y got Name, ID.

When i filter by name, the e parameter has ID="john"

im using jqgrid 4.4.0.

I change the column order with the mouse from the UI.

Jqgrid code:

 grilla.jqGrid({

datatype: function (e) {

dataTypeGrillaEnServerConSort(grilla, actualizarDatos, e, getDatos, !primeraCarga);

},

rowNum: Math.max,

colNames: ['id', 'Apellido Y Nombre', 'Mail', 'Documento', 'Edad', 'Foto'],

colModel: [

{ name: 'id', index: 'id', align: 'right', hidden: true },

{ name: 'nombre', index: 'nombre', width: 60, align: 'left', sorttype: 'text' },

{ name: 'mail', index: 'mail', width: 60, align: 'left', sorttype: 'text' },

{ name: 'documento', index: 'documento', width: 10, align: 'left', sorttype: 'text' },

{ name: 'edad', index: 'edad', width: 10, align: 'right', sorttype: 'number' },

{ name: 'foto', index: 'foto', width: 30, align: 'left', sorttype: 'number', formatter: eliminarFormatter }

],

sortname: 'nombre',

sortorder: "asc",

sortable: true,

caption: "Personas",

emptyrecords: "No hay ninguna persona cargada.",

loadtext: "Cargando...",

autowidth: false,

height: 300,

cellsubmit: 'clientArray',

width: 1200,

pager: "#pager",

rowNum: CANTIDADDEFILASPORPAGINA,

viewrecords: true,

gridComplete: function () {

//mostrar la barra de filtros

grilla.filterToolbar();

grilla.find("img").error(function () {

$(this).attr('src', pathFotoNoEncontrada);

});

}

});

分享给朋友:
您可能感兴趣的文章:
随机阅读: