sort-dialog.js
1.06 KB
$(function() {
"use strict";
$("#sort-rule-list").sortable().disableSelection();
$('#cancel-sort-order').click(function(){
$( "#sort-dialog-form" ).dialog( "close" );
});
$('#save-sort-order').click(function(){
var a_tergo = $('#sort-dialog-form').find('#entries_a_tergo').value();
var list_table = $('#sort-rule-list').find('li');
//lista par (nazwa pola - porzadek sortowania)
var rules = [];
for (var i = 0; i < list_table.length; i++){
var col_name = list_table[i].id;
var rule = {
field : col_name,
order : $('#order-' + col_name).value()
};
if (col_name === 'entry') {
rule.a_tergo = a_tergo;
}
rules.push(rule);
}
//dobieramy sie do danych grida
$('#scroll').jqGrid('getGridParam', 'postData').sort_rules = $.toJSON(rules);
jqgrid.grid.jqGrid('setGridParam', {'setOnComplete' : true});
//zmiany w nagłówkach kolumn
jqgrid.refresh_column_headers();
$( "#sort-dialog-form" ).dialog( "close" );
jqgrid.grid.trigger("reloadGrid");
});
});