Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - [email protected]

Pages: [1]
1
Took a while and a lot of hackery but I assembled something that performs the job. Basically I had to assemble a selectedDataIndices object and attach this to the dataModel so that PQ knew if the cell was selected (when out of view), add / remove data from the cell selection set, add / remove the css selection classes depending on a condition and lastly invoke the refresh method. Like a said it's hacky and not perfect, but it seems to be working. Here's the new jsfiddle:

http://jsfiddle.net/xBJxh/22/

2
 I'm using PQ to display data to users where they select any number of cells to post back to server. Users may select all cells in a column by clicking on a column header or select individual cells. However a row cannot have more than one cell selected. I jsFiddled some hackety-hack code that basically gets at what the users want but it's buggy -- if I select CellA, then CellB in the same row, CellA deselects. This is good. But If I go back and reselect CellA the ui does not update the cell with the selection color. I tried using some jq dom work to inject the class with no luck. When the refreshDataAndView is invoked it removes the injected class. Here's my jsFiddle:


http://jsfiddle.net/xBJxh/5/

3
The way I did it was to add a boolean property to my model. I hid this col from view. On the create event I looped through the data model and evaluated the boolean property. In cases where this was true I added the row to the selection set.

Code: [Select]
var obj = $.paramquery.tableToArray(tbl);
var pqObj = {
colModel = obj.colModel,
dataModel = obj.daaModel,
create: function (evt, ui) {
$.each(ui.data, function (i, d) {
if (d[5] == 'True') {
$('#gridTable').pqGrid('setSelection', { rowIndx: i });
                }
});
}
}
}
// hide the IsChanged column
$.extend(pq.colModel[5], { hidden: true });
$('gridTable').pqGrid(pqObj);

Happy coding.

Pages: [1]