We are using the AW Grid as a client-side Atlas control. We make an Atlas (AJAX) call to get some data, then populate the grid using the JSON data returned from our call. All of this happens in the pageLoad() Atlas event that gets fired by the Atlas code once all of the Atlas scripting objects are initialized. We are seeing a couple of strange issues. First, we set column widths on the grid using obj.setColumnWidth(). This is fine, except that there is apparently some code running AFTER our code to render the grid that causes the column widths to reset to default sizes. The second issue is related. We are also using client postbacks and Atlas UpdatePanels to respond to the click event on the grid and go fetch the detail data for the selected row. This works fine. When we make an AJAX call to update some data, we refresh the grid and then try to select the active row in the grid using obj.setSelectedRows. This also works, but the code mentioned above that is apparently firing AFTER our pageLoad is causing the grid to scroll up a row. I saw another post about the grid scrolling up a row and "forcing" it to scroll to the first row using setScrollTop. This works, but then when the "mystery" code executes, the grid re-scrolls back up a row. Hopefully this long-winded explanation makes sense. I'm just wondering whether anyone else has been playing with using the AWGrid along with Atlas controls in .NET? Any other ideas how we might accomplish what we are attempting to do? Thanks.
Wednesday, July 19, 2006
Here is a possible explanation (just guessing) - the grid updates column width by adding a CSS rule to the last <style> block. If somehow the Atlas UpdatePanel re-writes/re-creates the style block - the column width rules will be lost. Maybe it rewrites the grid html as well?
I would suggest replacing grid.toString() method with your own (which calls the default) and adding a breakpoint there so you can see who is calling it (using call stack window in debugger).