My problem: . When I drag a row to jqGrid and complete the user reload function, the grid cells, previously all the different widths set when defining the grid, change to all of them will be the same width. This happens in Webkit browsers, but not in Firefox.
Code:
I drag and drop for sorting allowed on the grid:
$mygrid.jqGrid(
'sortableRows', {
update: function(e, ui) {
sort_grid(e, ui);
}
}
);
As you can see, I have a sorting function, which is called the complete the drag, sort_grid. There he is:
function sort_grid(e, ui) {
var current_grid = $(ui.item[0]).closest('table').attr('id');
var $current_row, moved_id, next_id, next_priority;
var $moved_row = $('#' + current_grid + ' tr');
var cnt = 0;
this_id = ui.item[0].id;
$moved_row.each(function () {
if ($(this).attr('id') == this_id) {
$current_row = $moved_row.eq(cnt);
moved_id = $current_row.attr("id");
next_id = $current_row.next().attr("id");
next_priority = $current_row.next().children("td:first").attr("title");
}
cnt++;
});
if ( typeof moved_id !== 'undefined' ) {
if ( next_priority == 'undefined' ) {
next_priority = '999';
}
$.ajax({
url:my_url,
type:"POST",
data:"moved_id=" + moved_id + "&next_id=" + next_id + "&next_priority=" + next_priority,
success: function(data) {
$('.grid').setGridParam({loadonce:false, datatype:'json'});
$('#' + current_grid).trigger("reloadGrid");
$('.grid').setGridParam({loadonce:true});
}
})
}
}
As soon as I click on this resettable trigger $('#' + current_grid).trigger("reloadGrid");and reboot, the grid now has the wrong width in the grid cells (they go from different widths to the same widths).
, , jqGrid:
colModel:[
{name:'one', index:'one', sortable:true, width:45},
{name:'two', index:'two', sortable:true, width:180},
]
reset ( , , ). , , , - ?
$('.grid').setGridParam({
colModel:[
{name:'one', index:'one', sortable:true, width:45},
{name:'two', index:'two', sortable:true, width:180},
]
});
, colModels , . Weirder, javascript, . .
jqGrid " Man" (Oleg) ... lol.