sort-dialog.js
1.04 KB
$(function() {
$( "#sort-rule-list" ).sortable();
$( "#sort-rule-list" ).disableSelection();
$('#cancel-sort-order').click(function(){
$( "#sort-dialog-form" ).dialog( "close" );
});
$('#save-sort-order').click(function(){
var a_tergo = $('#sort-dialog-form #entries_a_tergo').value();
var list_table = $('#sort-rule-list 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);
grid.jqGrid('setGridParam', {'setOnComplete' : true});
//zmiany w nagłówkach kolumn
refresh_column_headers();
$( "#sort-dialog-form" ).dialog( "close" );
grid.trigger("reloadGrid");
});
});