EasyUI Forum
May 15, 2024, 02:58:04 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Pivot Grid Column Order  (Read 10918 times)
Prasad
Newbie
*
Posts: 4


View Profile
« on: March 07, 2016, 10:39:52 AM »

I am using Pivot Grid to display "Jan to Dec" columns.  Unfortunately, the column order is not maintained.  I am getting random column order for each refresh/filter.  Is there a way to control the column order?
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: March 07, 2016, 08:47:43 PM »

Please show an example with some sample data to demonstrate your issue.
Logged
Prasad
Newbie
*
Posts: 4


View Profile
« Reply #2 on: March 10, 2016, 11:56:24 PM »

Sorry for the late reply.

I could not attach an image.  I tried to reproduce in jsfiddle, but didn't manage to make it work.  But I believe you could help me by looking at the code.  Thank you.

https://jsfiddle.net/zgxege1w/24/
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #3 on: March 11, 2016, 10:29:07 AM »

Please refer to http://jsfiddle.net/zgxege1w/25/
Logged
Prasad
Newbie
*
Posts: 4


View Profile
« Reply #4 on: March 11, 2016, 03:58:57 PM »

Wow, jsfiddle is working.  [I didn't expect <style> tag to be reversed]


Coming back to the original request,  Is it possible to correct the order of column in ascending?  Jul-16 followed by Dec-16.  Appreciate your help. 
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #5 on: March 11, 2016, 07:20:45 PM »

You have to sort your data according to your custom logic before loading into pivotgrid.
Code:
data.sort(function(r1,r2){
...
});
$('#pg').pivotgrid({
data: data
...
});
Logged
Prasad
Newbie
*
Posts: 4


View Profile
« Reply #6 on: March 11, 2016, 08:33:31 PM »

Thanks a lot.  Saved my day Smiley

http://jsfiddle.net/zgxege1w/35/
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!