How to order the columns(fields) of a table

  • 1
  • Question
  • Updated 2 years ago
  • Answered
I have a requirement to create a rolling 12 month table of data.  The question is on how to order the columns.  

Where current month is April 2017

The columns currently display data like so...
January, Feb, March, April, May, June, July, August, Sept, Oct, Nov , Dec

But it should display
May, June,July,Aug,Sept,Oct,Nov,Dec, January, Feb, March, April

Is there a way to manipulate the columns prior to rendering?
Photo of Jaime

Jaime

  • 1,220 Points 1k badge 2x thumb
  • hopeful

Posted 2 years ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
You want the columns to dynamically render in order next month, next month + 1, next month + 2 ... ?

If so, fairly certain this can be done with snippet, just not sure how.
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Jaime,

You may be able to handle this need using Aggregate models and Model Lookup formula fields.  I think it would depend upon the data that you need to show.  For example, you can build an aggregate model using 'THIS_MONTH' as the condition on a date field.  You can build a second using 'LAST_MONTH' as the condition; etc.  Then use a Model Lookup field to pull in the 'LAST_MONTH' data as a column with 'THIS_MONTH'.  You might be able to use an Aggregate model for the column labels as well.

Let me know if this makes sense.

Thanks,

Bill
Photo of Jaime

Jaime

  • 1,220 Points 1k badge 2x thumb

this is what I'm trying to accomplish.

Photo of Jaime

Jaime

  • 1,220 Points 1k badge 2x thumb
thanks for the response!
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Jaime,

The 'snippet' is the way to go.  I can think of 2 approaches.  One approach is to manipulate the Personalization framework to reorder the columns.  I am not sure if Skuid provides any APIs that you can use.  The other 'more standard' approach is to create a custom component--even if its just a 1 page component where you dynamically create the 'Skuid table' XML.  You really just need to change the order of the columns based on the current month.

Thanks,

Bill
Photo of Jaime

Jaime

  • 1,220 Points 1k badge 2x thumb
hey Bill can you expand on this a bit more?

1-personalization framework

2-dynamically create a skuid table


thanks!
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Jaime,

1-personalization framework - In the Brooklyn release, Skuid allows users to modify the order of the columns that show on a table component.  My thinking is that you should be able to override these settings on the page that shows your table.  I don't know if Skuid allows you to change these settings on the page.  I saw this on the community:  https://community.skuid.com/skuid/topics/personalization-settings.  It appears that you can't change the object directly.

2-dynamically create a skuid table - I am pretty sure this will work, but it's an all Javascript solution.  You create a Skuid component that decides what order to display the columns, builds the XML for the table component and then renders it to the screen.  If you only need this on one Skuid page, then you can create a single page component.  If not, then you would want to create a 'full' Skuid component that would show in the page builder that you could drop onto any page you build.

3- add 12 tables to your page - Since it appears you have the columns of data you need on your object, you should be able to add 12 tables to your page and conditionally show only 1 based on the current month.  Setup a UI only model with a formula field that grabs the Month from Today's date.  Use this field to show the appropriate table.

Thanks,

Bill
Photo of Jaime

Jaime

  • 1,220 Points 1k badge 2x thumb

thanks Bill....


3- seems like the easiest to do just not a clean solution

2- I'm thinking that I may be able to build an table using parts of this tutorial

 http://help.skuid.com/m/11720/l/228794-dynamic-creation-of-models-and-components-with-javascript#!prettyPhoto