I am trying to update the value of a cell through any means possible (innerHTML, cell.appendChild(), etc) and it appears that it is working when I step through the code, but it does not actually reflect the change in the browser. Its almost like the elements on the page are readonly.
Does anybody have any ideas as to why this is not updating on the browser? Please let me know if you need any more info.
Thanks,
Andrew
Hello Andrew,
I believe an easier approach and one that would give more consistent results would be using the client-side object model of UltraWebGrid (CSOM) instead of directly manupilating the DOM elements.
You just need to obtain a reference to the "cell" you need to modify and use the setValue method instead of directly using innerHTML/appendChild etc.
List of available cell client-side API methods/properties is available here:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.1/CLR2.0/html/WebGrid_cell_Object_CSOM.html
Sample code and additional information can be found here:
http://help.infragistics.com/Help/NetAdvantage/NET/2007.2/CLR2.0/html/WebGrid_Object_CSOM.html
For example this is how you show the value of the first cell of all selected grid rows with BLOCKED SCRIPT
for(var rowId in grid.SelectedRows){ var row=igtbl_getRowById(rowId); alert(row.getCell(0).getValue());}
Hope this helps.
Hi Rumen and thanks for your reply. The setValue() and other methods now work as expected; the problem was really with the postback-ing of the grid on a client click. Any changes I had made to the DOM, wether via setValue() or otherwise were getting immediately overwritten by the postback return content. I only found this after running fiddler and seeing the traffic to the server after the client click.
Do you know why the grid will post back if a client event handler is registered for the event? It does not make sense to me that a call to the server is necessary in those cases.
Most probably this is a setting (e.g. a property set to a value that requires postback). Maybe you have hooked some server-side events, or enabled server-side editing / updating in any way? I started with a very basic grid and hooked only the client-side CellClickHandler and the grid did not postback for me when clicking on a cell (I verified that with FireBug for FireFox, which works pretty much in a similar way like IE Web Dev Toolbar and Fiddler)
<igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" Height="200px" Width="325px"> <Bands> <igtbl:UltraGridBand> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> </igtbl:UltraGridBand> </Bands> <DisplayLayout BorderCollapseDefault="Separate" Name="UltraWebGrid1" RowHeightDefault="20px" Version="4.00" ViewType="Hierarchical"> <ClientSideEvents CellClickHandler="CellClick" /> </DisplayLayout> </igtbl:UltraWebGrid> <script type="text/javascript" > function CellClick(gridID, cellID) { alert(cellID); } </script>
What could be different in your case?
This is what the control def looks like, is it the Band AllowUpdate?
<igtbl:UltraWebGrid ID="UltraWebGridActivities" runat="server" Height="370px" Style="top: 0px" Width="99%" StyleSetName="EpitomeBlue" StyleSetPath="../ig_res"> <Bands> <igtbl:UltraGridBand AllowUpdate="Yes"> <AddNewRow View="NotSet" Visible="NotSet"> </AddNewRow> </igtbl:UltraGridBand> </Bands> <DisplayLayout AllowColSizingDefault="Free" AllowColumnMovingDefault="OnServer" AllowSortingDefault="Yes" BorderCollapseDefault="Separate" HeaderClickActionDefault="SortMulti" Name="UltraWebGridActivities" RowHeightDefault="20px" Version="4.00" ViewType="Hierarchical" StationaryMargins="Header" TableLayout="Fixed" CellClickActionDefault="RowSelect" SelectTypeRowDefault="Extended" AllowUpdateDefault="Yes"> <ActivationObject BorderColor="" BorderWidth=""> </ActivationObject> <FrameStyle Width="99%" Height="370px" TextOverflow="Ellipsis"> </FrameStyle> <Pager AllowPaging="True" AllowCustomPaging="True" StyleMode="ComboBox" PagerAppearance="Both" PageSize="20"> </Pager> <ClientSideEvents CellClickHandler="UltraWebGridActivities_CellClickHandler" InitializeLayoutHandler="defaultController.initGrid" /> </DisplayLayout> </igtbl:UltraWebGrid>
Could be it, or the CellCickActionDefault="RowSelect"...most probably you will need to switch features off one by one in ordetr to see which specific one (or combination of which) does this
In any case, calling s
the client-side event handler should probably resolve the problem.