IG Hack - #2 Display Column Name from Query as Interactive Grid Column Heading
This blog explains, how to display column name from query as IG column heading.
Let me explain this with a use case:
Developer 1: The region source of my IG is Function Body returning SQL query. I want to display the column alias name given in my SQL queries as the IG column heading. Can this be achieved?
Developer 2: Ofcourse, yes! You can also display the column name/alias even if the region source is SQL Query.
Let's Start....
1) Create an IG in the page. Select the region source as SQL query. Paste the below code.
Note:
- The region source can be SQL Query (or) Function Body returning SQL query (based on the requirement).
- I am using the above SQL query because I did not want to complicate the use case.
2) Put the below code in the Attributes -> JavaScript Initialization Code of the IG.
Important Note: In the above code, i=0 must be changed to i=1 if the IG is editable.
4) Save and Run the page.
Click here for DEMO
Hi, the code works fine but when I downloaded to xls it comes with original columns name
ReplyDelete