Author Topic: Version 2.2.0 issues  (Read 4337 times)

dbadmin

  • Pro Economy
  • Jr. Member
  • *
  • Posts: 67
    • View Profile
Version 2.2.0 issues
« 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!

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6298
    • View Profile
Re: Version 2.2.0 issues
« Reply #1 on: September 18, 2014, 07:44:59 pm »
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.

dbadmin

  • Pro Economy
  • Jr. Member
  • *
  • Posts: 67
    • View Profile
Re: Version 2.2.0 issues
« Reply #2 on: September 18, 2014, 09:34:30 pm »
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" } );

}

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6298
    • View Profile
Re: Version 2.2.0 issues
« Reply #3 on: September 18, 2014, 10:13:11 pm »
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

dbadmin

  • Pro Economy
  • Jr. Member
  • *
  • Posts: 67
    • View Profile
Re: Version 2.2.0 issues
« Reply #4 on: September 18, 2014, 11:58:47 pm »
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!

dbadmin

  • Pro Economy
  • Jr. Member
  • *
  • Posts: 67
    • View Profile
Re: Version 2.2.0 issues
« Reply #5 on: September 19, 2014, 03:39:34 am »
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!

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6298
    • View Profile
Re: Version 2.2.0 issues
« Reply #6 on: September 19, 2014, 10:26:50 pm »
it can be done in the create event or after initialization of grid.

http://jsfiddle.net/paramquery/chmxdzfo/