Hi,
I want to have my own custom sorting algorithm in JS on a ultraWebGrid column, and also allow users directly modifing cell values.
I followed the Url below to do the Client side sorting of a particular column in the UltraWebGrid.
http://help.infragistics.com/Help/NetAdvantage/ASPNET/2010.1/CLR3.5/html/WebGrid_Defining_a_Custom_Sorting_Algorithm_Client_Side.html
I cannot get it to work until I do the following:
UltraWebGrid1_InitializeLayout() {
e.Layout.LoadOnDemand = Infragistics.WebUI.UltraWebGrid.LoadOnDemand.NotSet; // or other non-Xml options...
}
because in the sorting Javascript (below), if the LoadOnDemand is Xml or 3, it performs sortXml(),
not my custom sorting function.
function igtbl_clctnSort(sortedCols){ if( !this.Band.IsGrouped && this.Grid.LoadOnDemand==3) return this.sortXml(); ...
However, once I set the LoadOnDemand property to anything other than Xml, custom sorting works,
but if I edit a data cell (with column DataType= System.String),
then I move the mouse focus to another cell, the cell value will change from the new value I entered,
back to the old value! I think it may cause a post back somehow. I can only fix this problem by setting the LoadOnDemand back to Xml.
But then I cannot do custom sorting!
Any ideas? I am using NetAdvantage_ASPNET_20092 for CLR3.5
Thanks.
try this..
dgGrid.DisplayLayout.LoadOnDemand =
LoadOnDemand.Automatic;
dgGrid.ResetColumns();
dgGrid.ResetRows();
-Ani
During the InitializeLayout(),
I tried to replace LoadOnDemand.Xml with the 3 statements you suggested. It came back with
a Null Reference Exception when it ran the next statement:
dgGrid.Columns.FromKey(aColumnName).Hidden = True
If I moved the ResetColumns() and ResetRows() after the above statement, the grid displayed "No data to display".
OK. Just tried that.
If the Resetxxx() is moved to beccome the first statement(s) in InitializeLayout() to run, same Null Reference exception happened on
FromKey(_uniqueIDColumnName).Hidden assignment statement, same
as before.
If I moved the Resetxxx() to UltraWebGrid_Init(), it has no visual effect.
I don't know if I explained the data sync problem clearly. Basically, if LoadOnDemand is not Xml,
for a string data column trying to hold "decimal" value, it is like:
. In a cell, I changed it from "1" to "1.00", and hit tab. The cell displayed "1" (should be "1")
. Same cell, I changed it to "1.01", and hit tab. The cell displayed "1.00" (should be "1.01")
. Same cell, I changed it to "1.02" and hit tab. The cell displayed "1.01" (should be "1.02")
Hence it is like the cell displays the cell value just 1 step out of sync!
move these statement before initialize layout and check.