Author Topic: Change Column properties based on the Row data  (Read 2550 times)

cijojohn

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 73
    • View Profile
Change Column properties based on the Row data
« on: March 16, 2017, 04:42:33 am »
Hi Team,
 
I have a requirement to change properties of a column based on the row . Same column for different row will have different properties.
We are working on a licensed version 3.3.5 pq. Please respond at the earliest

Regards,

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Change Column properties based on the Row data
« Reply #1 on: March 16, 2017, 09:18:34 am »
I wish you could be more clear on what properties you want to change on row basis.

column properties like dataIndx, dataType, cb, filter can't be changed for individual rows.

Layout or rendering of individual cells can be changed on row basis with help of column.render callback.

https://paramquery.com/pro/demos/condition_style

https://paramquery.com/pro/api#option-column-render

Editor can also be changed for individual rows in same column with help of column.editor callback.
« Last Edit: March 16, 2017, 09:26:13 am by paramquery »

cijojohn

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 73
    • View Profile
Re: Change Column properties based on the Row data
« Reply #2 on: March 20, 2017, 08:30:23 pm »
Please find the attachment. I want to define the properties of the cells based on my row data.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Change Column properties based on the Row data
« Reply #3 on: March 20, 2017, 09:36:36 pm »
1. rowInit is used for whole rows while column.render is used for individual columns.

In column.render different styles, classes and attributes can be assigned based on rowData.

For example: https://paramquery.com/pro/demos/condition_style

column.render is used in company column to conditionally make the cells italic based on rowData.

Code: [Select]
render: function (ui) {
                        if (ui.rowData.profits < 8000) {
                            return {
                                //can also return attr (for attributes), cls (for css classes) and text (for plain or html string) properties.
                                style: 'font-size:20px;font-style:italic;'
                            };
                        }
                    }         

2. There is no property called as col type but if you mean by dataType then every column has fixed dataType and it can't be changed for individual rows.
« Last Edit: March 20, 2017, 09:42:02 pm by paramquery »