Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
170
Dynamic custom sorting
posted

I am trying and failing to implement dynamic sorting. We have dynamic level hierarchical data and we want to sort only for last level.

I am tring to do that by:

        protected void OnInitializeBand(object sender, BandEventArgs e)
        {
            var control = sender as WebHierarchicalDataGrid;

            if (e.Band.Key == DataViewName)
            {
                var behaviors = e.Band.Behaviors;
                if (behaviors.Sorting == null )
                {
                    behaviors.CreateBehavior<Sorting>();
                }
            }
        }

While having auto AutoGeneratedBinds set to true and Ajax enabled. All looks nice but I am having error at:

$IG.SortingAction.prototype =
{
 get_value:function()
 {
  var sortedCols = $IG.SortingAction.callBaseMethod(this, 'get_value');
  var serverSortCols = [];
  for(var colIndex in sortedCols)
  {
   var col = sortedCols[colIndex];
   serverSortCols[serverSortCols.length] = {id:col.get_idPair(), sortDirection:this._object.getSortDirection(col)};
  }
  return serverSortCols;
 }
}

value of colIndex is "remove"

Do I initialize this sorting properly.

Thanks for answer

 

  • 2783
    posted

    Hi,

    How are you initiating the sorting action itself?  I am guessing you are sorting programmatically, I believe the problem is in the code for how you are initiating the sorting action itself, if you post that I can take a look at it and provide you with more information.

    I ran your Sorting behavior initialization dynamically, with a WHDG binding to a dataset and initiating sorting on the last level grid by clicking on the header did not give me errors.  Try to initiate the sorting action by clicking on the header of that level grid, and see if the problem still occurs that way we'll know for sure if the issue is with how sorting gets initiated.

    Thanks,
    Olga