Reputation: 3050
I have a grid which I want to show dynamically on 2 directions when the default one is ltr.
I want to be able to change the grid direction to rtl and to reload its content on a button click.
How can I dynamically change the grid's direction?
UPDATE:
I'm using $('#grid').setGridParam({direction: rtl\ltr})
according to the direction I want , and the grid's content is changed, but the columns are the same as they were. is there a way to change the columns direction as well?
Thank's In Advance.
Upvotes: 0
Views: 769
Reputation: 455
If you have a button with an id of button and a jqGrid with an id of grid then:
$('#button').on('click', function () {
if ($('#grid').getGridParam('direction') == 'ltr')
$('#grid').setGridParam({direction: 'rtl'});
else
$('#grid').setGridParam({direction: 'ltr'});
$('#grid').trigger('reloadGrid');
}
You can read about the grid methods (getGridParam and setGridParam here and the direction property of jqGrid here
Upvotes: 4