ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: dbadmin on September 17, 2014, 11:32:01 pm
-
Hi,
First of all, I wanted to say that it's great to have copy/paste Excel option! Thanks a bunch!
So with the new version I am getting the following 2 issues:
1. When exporting to excel getting an error "TypeError: h.title is undefined". And a hidden column gets exported.
2. When using $grid.pqGrid("editCell", {rowIndx: 1, dataIndx: "Name" } ); getting an error "e is undefined".
Please advise.
Thanks!
-
1) There is new property column.copy. When you don't want to export a column, set it to false. And title needs to be defined for every exportable column.
http://paramquery.com/pro/api#option-column-copy
2) editCell method works fine. Probably you need to provide more details.
-
1. Setting "copy:false" did help, thank you! I'd think it may make sense to base copying off hidden:true, too. Since if I hide the column initially that probably makes sense I don't want it to be visible in any situation.
2. Here's the code where I get the error with editCell:
function LoadBlock()
{
if($("#grid_array").hasClass( 'pq-grid') == true )
{
$("#grid_array").pqGrid("destroy");
}
var dataModel = {
location: "remote",
sorting: "local",
dataType: "JSON",
method: "POST",
getUrl: function (ui)
{
return {
url: "/..../GetData.php"
};
},
getData: function (dataJSON)
{
if (dataJSON.error != null)
{
alert ("Error: " + dataJSON.error.msg + "\n Please contact administrator with your input!");
}
var data = dataJSON.DataArray;
return { data: data };
},
error: function (err)
{
alert ("Error: " + err + "\n Please contact administrator with your input!");
}
};
colModel = [
{hidden: true, editable:false, dataIndx: "ID", copy:false},
{title:"Row", width:10, dataType:"string", editable: false, align:"right", dataIndx: "BlockRow"},
{title:"Col", width:10, dataType:"string", editable: false, dataIndx:"BlockColumn"},
{title:"Name", width:200, dataType:"string",editable: true, dataIndx:"Name"}
];
var $grid = $("#grid_array").pqGrid({
dataModel: dataModel,
colModel: colModel,
editable: true,
editModel: {clicksToEdit: 2, saveKey: $.ui.keyCode.ENTER},
editor: {type: 'textbox', select: true, style: 'outline:none;'},
scrollModel: {pace: 'fast', horizontal: true},
flexWidth: true,
flexHeight: true,
numberCell: false,
sortable: false,
freezeCols: 3
});
$grid.pqGrid("editCell", {rowIndx: 1, dataIndx: "Name" } );
}
-
2) The data is not available by the time you call editCell because of remote request. You need to call editCell in load event.
http://paramquery.com/pro/api#event-load
-
That helped! Thanks!
And I just wanted to mention that I do not get notified when this thread is updated, although I clicked "Notify" button. I have noticed it happening with another thread as well. So just wanted to bring it up. I wonder if something may be wrong with the mail server.
Thanks again!
-
One more question regarding #2.
Which event should I bind to when I don't use remote data loading? I tried refresh, beforeTableView and couple others but none seem to help.
Thanks!
-
it can be done in the create event or after initialization of grid.
http://jsfiddle.net/paramquery/chmxdzfo/