Author Topic: Several questions..  (Read 2055 times)

kiwon34

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 52
    • View Profile
Several questions..
« on: July 26, 2017, 01:32:21 pm »
1. Is there a way to designate the row count when using stripeRows option? For example,. I want to give option for every 5 rows to be changed.

2. How do I remove a certain column's right or left border when 'columnBorders' option is true?

3. Way to display one record in multi-line?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Several questions..
« Reply #1 on: July 27, 2017, 12:09:03 am »
1. css nth selector for rows ( .pq-grid-row ) can be used instead of stripeRows option to highlight every 5th row.

2. grid cells have right borders only.
To remove it for a column, assign some class to that column. cls: 'noborder'

And write a css rule.
Code: [Select]
.pq-grid .pq-grid-cell.noborder{
border-right-width:0;
}

3. use wrap: true
« Last Edit: July 27, 2017, 12:11:14 am by paramquery »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Several questions..
« Reply #2 on: July 27, 2017, 11:28:41 am »
First one ( highlight every 5th row) can also be done with script with help of rowInit callback.

Code: [Select]
rowInit: function(ui){
  if(ui.rowIndx%5 == 0){
    return {style: 'background:red;'};
  }
}

Example of using rowInit: https://paramquery.com/pro/demos/condition_style

kiwon34

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 52
    • View Profile
Re: Several questions..
« Reply #3 on: July 27, 2017, 02:21:56 pm »
Thanks a lot!

Though maybe I wasn't clear about the third question.  What I meant about display in multi line for one record, if there is a json data such as {"a" : "AAA", "b" : "BBB", "c" : "CCC", "d":"DDD"...} for one record, I want to display "AAA" and "CCC" in one cell as multi line, and "BBB" and "DDD" in the right cell also as multi line. And other records continued to show the same.
Is this possible?
Please tell me if the question is still not clear.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Several questions..
« Reply #4 on: July 27, 2017, 04:27:20 pm »
It can be done with column.render callback

Code: [Select]
//column definition.
{
  dataIndx: 'a',
  render: function( ui ){
    var rd = ui.rowData;
    return rd.a + "<br/>" + rd.c;
  }
}