1

I have this code, which works fine if a cell in the IgGrid control is being edited:

var verticalContainer = $("#BookLabor_scrollContainer");
var topPos = verticalContainer.scrollTop();
$("#BookLabor").igGrid("option", "dataSource", blankLaborDS);
$('#BookLabor').igGrid('dataBind');
verticalContainer.scrollTop(topPos);

However, when I use an IgDialog that I have pop open on a grid cell with a button click event, this is not scrolling back to the row being edited:

var verticalContainer = $("#BookLabor_scrollContainer");
var topPos = verticalContainer.scrollTop();
$("#BookLabor").igGrid("option", "dataSource", blankLaborDS);
$('#BookLabor').igGrid('dataBind');
verticalContainer.scrollTop(topPos);

There is a virtual scroll method for the IgGrid, but the online documentation does not explain in detail how to use it.

Any tricks, tips, hints from all you Infragistics experts out there?

Konstantin Dinev
  • 34,219
  • 14
  • 75
  • 100
user1864392
  • 11
  • 1
  • 3
  • I forgot one line of code in the 2nd section. Just before the verticalContainer.scrollTop call I close the IgDialog. – user1864392 Jan 24 '13 at 14:45

1 Answers1

1

The scroll related API is very basic and what you are using is pretty much comparable:

  • .igGrid("scrollContainer") is merely a shorthand so you don't have to use #BookLabor_scrollContainer (it's an internal id)
  • .igGrid("virtualScrollTo", scrollContainerTop); is just like scroll top when you are using virtual scrolling, which you might be (can't tell without more code) so you might want to try that out.

HOWEVER, is there a reason to call dataBind after cell edit? ( I'm having a hard time finding a scenario for that). It is not intended by any means and it creates a lot of overhead with bigger data. If you need to update cell values you should be using the Updating API that does not require re-bind and will not require scroll after as well..see: http://help.infragistics.com/jQuery/2012.2/ui.iggridupdating#methods

As for the dialog, the Updating again provides a row template that internally uses the dialog and I highly recommend that if row editing is acceptable. Sample: http://www.infragistics.com/products/jquery/sample/grid/row-edit-template

Konstantin Dinev
  • 34,219
  • 14
  • 75
  • 100
Damyan Petev
  • 1,585
  • 7
  • 10
  • I'm waiting to hear back from Infragistics support about how to use the virtual scrolling to see if that will solve the problem. The reason we resorted to rebinding the datasource with our interactive grids (some of them calculate values for one column based on what is entered in other columns) is that we had issues with columns getting blanked out on edit when just setting values on cells in the grid. As long as we update our datasource (which is just a JSON type javascript array) and then rebind to the datasource, we're fine. – user1864392 Jan 25 '13 at 20:35
  • We also had issues with the IQueryable objects when trying to bind again to the controller/action post-render. Instead of getting the expected results, the grid would display the name of the controller/action down the lefhand column with one character per row. – user1864392 Jan 25 '13 at 20:37
  • OK, here's another issue, which is actually much more critical for our user community: We have some command buttons (part of their standard controls for grid cells), which open IgDialogs with filtered lists insde, but - if they are editing a cell in another column in the same row and then use the mouse to click one of those buttons (we have some handlers for iggridupdatingeditcellended that should not really matter) we get fatal runtime errors in Infragistics.js. – user1864392 Jan 31 '13 at 21:33
  • If they use tab or enter to complete the edit first, then the issue does not occur. – user1864392 Jan 31 '13 at 21:34
  • I remember I've seen some issues with editing session not being closed normally (when using the Updating API in addition) although your dialog sounds like it's not using that, but since it doesn't give errors when the user actually ends the editing himself... can you try with the "endEdit" method in the Updating API (use it to stop the editing on the row before you open the dialog)? Also it would be best if you post this one to our forums (or separate question here) in case this doesn't help. I really can't do much more from just comments :) – Damyan Petev Feb 01 '13 at 16:58
  • 1
    We have the vertical scrolling working after some experimentation. The key is to get the vertical scroll top position on the iggridcellclick event handler and then set the scroll position within the iggriddatarendered event handler. This works as long as the command button opens an IgDialog control, otherwise not because the button click handler and iggridcellclick events will fire off in reverse order in those cases. – user1864392 Feb 05 '13 at 16:38