1

I have a Flexgrid on a page. I want to do some custom filtering. I created a Filter ActonResult. In it I have created the filtered dataset. How do I send the data back to the page? If I return a view I don't get any updated data. Is there a way to send the data back to the page in Json and update via javascript?

kereberos
  • 1,253
  • 1
  • 10
  • 20

2 Answers2

1

I'd suggest you to use jQuery.ajax. You can call the action through the url attribute, get the filtered data in the 'success' callback and set the returned data as the itemssource of FlexGrid.

More info here and here

Community
  • 1
  • 1
AbdiasM
  • 613
  • 4
  • 15
0

I think you can use the ReadActionUrl to implement it.

In Controller, you can write the below similar Filter action.

public ActionResult Filter([C1JsonRequest] CollectionViewRequest<Category> requestData)
        {
            return this.C1Json(CollectionViewHelper.Read(requestData, **db.Categories.ToList().Skip(3)**));
        }

And in Viewer, you should use ReadActionUrl property

@(Html.C1().FlexGrid<Category>().Bind(Url.Action("Filter"))) //Use Bind method to set the ReadActionUrl property.
Usman Maqbool
  • 3,351
  • 10
  • 31
  • 48
Ryan
  • 1