This is a migrated thread and some comments may be shown as answers.

[Solved] Custom bound grid can't order?

1 Answer 69 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Joan Vilariño
Top achievements
Rank 2
Joan Vilariño asked on 18 May 2010, 11:53 AM
Hello.

I have a custom bound grid with .EnableCustomBinding(true), .Sortable() and 3 columns. at the controller I have this definition:

        [GridAction(EnableCustomBinding = true)] 
        public ActionResult _Index(GridCommand cmd) 
        { 
            // bleh.. bleh.. bleh.. 
        } 

The thing is that the "cmd" parameter comes with .Page and .PageSize, but when I click on a grid's header to sort by that column, the cmd's .SortDescriptors collection comes empty... (count = 0).

I've tried with Sortable(sort=>sort.SortMode(GridSortMode.SingleColumn)), with multiplecolumn, and with no parameters on Sortable. None of them work. Is that a fixed feature in sp1?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Davy
Top achievements
Rank 1
answered on 31 Jan 2011, 02:31 PM
try renaming the parameter from "cmd" to "command" 

the GridActionAttribute has the following WTF in its constructor:

public GridActionAttribute()
{
    this.ActionParameterName = "command";
    this.adapterFactory = DI.Current.Resolve<IGridActionResultAdapterFactory>();
}
i ran into the same issue you describe here, opened reflector, spotted this, renamed the parameter and everything suddenly works
as far as first impressions with this control set goes, this is not a good one...
Tags
Grid
Asked by
Joan Vilariño
Top achievements
Rank 2
Answers by
Davy
Top achievements
Rank 1
Share this question
or