ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: RedBully on April 11, 2014, 01:46:43 pm

Title: different editors in same column
Post by: RedBully 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
Title: Re: editor query
Post by: paramvir 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;

Title: Re: different editors in same column
Post by: RedBully 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.
Title: Re: different editors in same column
Post by: paramvir 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

Title: Re: different editors in same column
Post by: RedBully on April 11, 2014, 08:13:13 pm
Ta but

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

returning undefined for me.
Title: Re: different editors in same column
Post by: paramvir 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;
Title: Re: different editors in same column
Post by: RedBully on April 14, 2014, 01:44:45 pm
Thanks. A minor variant worked - I had to pass this into the function.