You can implement this column moving by including the following statement in UltrawebGrid’s Initialize Layout event.
Private Sub UltraWebGridClaimants_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.LayoutEventArgs) Handles UltraWebGridClaimants.InitializeLayout
With UltraWebGridClaimants.DisplayLayout
.XmlLoadOnDemandType = Infragistics.WebUI.UltraWebGrid.XmlLoadOnDemandType.Synchronous
.StationaryMargins = Infragistics.WebUI.UltraWebGrid.StationaryMargins.Header
.AllowColumnMovingDefault = Infragistics.WebUI.UltraWebGrid.AllowColumnMoving.OnClient
.Browser = Infragistics.WebUI.UltraWebGrid.BrowserLevel.Xml
End With
Also you can prevent some columns to not being movable. For this add the following script functions in your script file
// Prevent column moving for "Select" column.
function onBeforeColumnMove(grid, columnId)
{
if(columnId != undefined)
{
var column = igtbl_getColumnById(columnId);
if(column.Key == "Select")
return true;
}
}
// Prevent column moving for "Select" column.
function onColumnDrag(grid, columnId, targetColumnId)
{
if(targetColumnId != undefined)
{
var column = igtbl_getColumnById(targetColumnId);
if(column.Key == "Select")
return true;
}
}
And call these functions in appropriate events on Initialize Layout.
Private Sub UltraWebGridClaimants_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.LayoutEventArgs) Handles UltraWebGridClaimants.InitializeLayout
With UltraWebGridClaimants.DisplayLayout
.XmlLoadOnDemandType = Infragistics.WebUI.UltraWebGrid.XmlLoadOnDemandType.Synchronous
.StationaryMargins = Infragistics.WebUI.UltraWebGrid.StationaryMargins.Header
.AllowColumnMovingDefault = Infragistics.WebUI.UltraWebGrid.AllowColumnMoving.OnClient
.Browser = Infragistics.WebUI.UltraWebGrid.BrowserLevel.Xml
.ClientSideEvents.BeforeColumnMoveHandler = "onBeforeColumnMove"
.ClientSideEvents.ColumnDragHandler = "onColumnDrag"
End With
Happy Coding….
No comments:
Post a Comment