Author Topic: different editors in same column  (Read 4272 times)

RedBully

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
different editors in same column
« on: April 11, 2014, 01:46:43 pm »
Hopefully this one will post successfully. I'll add as an attachment as well in case not.

I am aware the param query grid is quite column centric in its design and implementation. We are trying to step out of this a little and are passing down grid metadata in JSON which we then want to consume in callback functions. This worked OK for editable and render but we
« Last Edit: April 11, 2014, 04:49:50 pm by paramquery »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: editor query
« Reply #1 on: April 11, 2014, 02:34:41 pm »
I see you are trying to use different editors for different cells in the same column.

ParamQuery offers column, row and cell level granularity so yes it's doable.

editor.type callback fn is supposed to provide rowIndx (it's added in next version) but that's not a big issue since you can get rowIndx from ui.rowData using method getRowIndx.

I guess there is no need to keep a separate cellMetaData array to store meta data (dataType) for the cells. rowIndx would change when you sort / filter the rows and that would cause misalignment between meta data and grid data.

It's better to store cell meta data in rowData which is quite simple and easy similar to the way pq_cellcls does for storing cell classes.

rowData[ namespace + '_dataType' ] [ dataIndx ] = constants.PropertyDataType.Date;

« Last Edit: April 11, 2014, 06:06:16 pm by paramquery »

RedBully

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
Re: different editors in same column
« Reply #2 on: April 11, 2014, 06:27:56 pm »
Very good. I'm struggling with the syntax for getRowIndx if you would provide an example please.

Instead of var r = ui.rowIndx;

?

Ta.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: different editors in same column
« Reply #3 on: April 11, 2014, 06:57:44 pm »
Code: [Select]
var rowIndx = $grid.pqGrid ( "getRowIndx", { rowData: ui.rowData } ).rowIndx;

http://paramquery.com/pro/api#method-getRowIndx


RedBully

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
Re: different editors in same column
« Reply #4 on: April 11, 2014, 08:13:13 pm »
Ta but

var r = $(gridId).pqGrid("getRowIndx", { rowData: ui.rowData }).rowIndx;

returning undefined for me.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: different editors in same column
« Reply #5 on: April 11, 2014, 11:08:09 pm »
Assuming your gridId is correct, it should be $("#"+gridId)

still it's better to use $(this)

Code: [Select]
  var rowIndx = $( this ).pqGrid ( "getRowIndx", { rowData: ui.rowData } ).rowIndx;

RedBully

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
Re: different editors in same column
« Reply #6 on: April 14, 2014, 01:44:45 pm »
Thanks. A minor variant worked - I had to pass this into the function.