[CLOSED] DirectEvent Actionmethod with StoreRequestParameters object

  1. #1

    [CLOSED] DirectEvent Actionmethod with StoreRequestParameters object

    Hi
    mine is a Razor view engine application.
    I have a gridpanel to which I have applied remote paging.
    On a button click through DirectEvent I am calling a Actionmethod.

    In the actionmethod I have following code

    public ActionResult ImportClick(string scenarioId, string type, StoreRequestParameters parameters)
            { 
    ...
    ...
    
    var store = this.GetCmp<Store>("Store1");
                    var finalPivotedList = GetPivotedList(AllScenarioSales);
    
                    System.IO.File.Delete(fname);
    
                   if (!string.IsNullOrEmpty(parameters.SimpleSort))
                    {
                        finalPivotedList.Sort(delegate(ProjectedSalesGridModel x, ProjectedSalesGridModel y)
                        {
                            object a;
                            object b;
    
                            int direction = parameters.SimpleSortDirection == SortDirection.DESC ? -1 : 1;
    
                            a = x.GetType().GetProperty(parameters.SimpleSort).GetValue(x, null);
                            b = y.GetType().GetProperty(parameters.SimpleSort).GetValue(y, null);
    
                            return CaseInsensitiveComparer.Default.Compare(a, b) * direction;
                        });
                    }
                    int limit = parameters.Limit;
                    if ((parameters.Start + limit) > finalPivotedList.Count)
                    {
                        limit = finalPivotedList.Count - parameters.Start;
                    }
    
                    List<ProjectedSalesGridModel> packs = (parameters.Start < 0 || limit < 0) ? finalPivotedList : finalPivotedList.GetRange(parameters.Start, limit);
                    var data = new Paging<ProjectedSalesGridModel>(packs, finalPivotedList.Count);               
                    store.LoadData(data);
    ...
    ...
      return new DirectResult() { IsUpload = true };
            }
    This code updates a stores records.

    The issues I face is;
    1) StoreRequestParameters object variables are -1 and null. Thus all records are set to the store and not as per page size
    2) The gridpanel is not showing any records in it.
    Last edited by Daniil; Oct 15, 2013 at 6:42 AM. Reason: [CLOSED]
  2. #2
    Hi @PriceRightHTML5team,

    A StoreRequestParameters should be used with requests initiated by a Store's Proxy, for example, an AjaxProxy one.

    Dealing with a regular DirectEvent, you can pass any additional parameters via ExtraParams.

Similar Threads

  1. Replies: 0
    Last Post: Aug 28, 2013, 6:59 AM
  2. Replies: 15
    Last Post: Mar 06, 2013, 2:47 PM
  3. Replies: 1
    Last Post: Dec 06, 2012, 7:33 PM
  4. Replies: 1
    Last Post: Jun 27, 2012, 9:19 PM
  5. Replies: 0
    Last Post: Oct 21, 2011, 3:04 AM

Tags for this Thread

Posting Permissions