[CLOSED] MVC Grid Problem Paging

  1. #1

    [CLOSED] MVC Grid Problem Paging

    First, I may be doing this completely differently than I should as I am not as familiar with Ext as other control sets, so please bear with me.

    I have a grid where I want to, on the fly, repopulate the grid based on the parameter passed in the URL:
    (e.g. URL - /_GetTeams/1, /_GetTeams/2 - etc. Please note that the parameter passed in is an EMPLOYEE ID, not a team ID.) In order to make this work, I have set up my grid's store proxy API to have a default read like this:

    With prxy
    .API.Read = Url.Content("~/Assignments/_GetTeams/") + MvcApplication.CurrentApplicationUser.EmployeeID.ToString()
    End With
    I also have pagination configured for my grid:
    .BottomBar(Sub(footer)
                                                                     Dim pager As New Ext.Net.PagingToolbar()
                                                                     With pager
                                                                         .AutoDataBind=True
                                                                     End With
                                                                     footer.Add(pager)
                                                             End Sub)
    Now, my initial load of the grid is autoloaded. However, I have radio buttons at the top of the page which allow for the changing of the view (the default is "My Teams"). Some options are "My Teams," "All Teams," "My Direct Reports" - etc. and my goal is not to completely post-back the whole page (hence the proxy).

    In order to accomplish this, I have events which capture the selected radio and switch off the value, and then the script reloads the grid store:
    function RebindGrid(e) {
               var linkRef = "/Assignments/_GetTeams/" + e.toString();
                App.TeamGrid.store.proxy.api.read=linkRef;
                App.TeamGrid.store.load();
            }
    The data being returned is correct and binds to the grind 100% correctly However, pagination does not work. The toolbar has the correct number of pages and total. The toolbar will even "paginate," (page number increments) but every row of data is returned every time. I didn't catch it for a while because most results are only 1 page, but "All Teams" is long. I am completely fine with returning all the data an doing client-side pagination, but I am open to handling it server-side if that is how it must be handled (the post definitely has the pagination info in it: http://server/Assignments/_GetTeams/...22ASC%22%7D%5D). However, most importantly, I am trying to figure out how the correct way to handle this scenario.

    Any help is appreciated.
    Last edited by Daniil; May 18, 2012 at 5:00 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Quote Originally Posted by adelaney View Post
    I have a grid where I want to, on the fly, repopulate the grid based on the parameter passed in the URL:
    (e.g. URL - /_GetTeams/1, /_GetTeams/2 - etc. Please note that the parameter passed in is an EMPLOYEE ID, not a team ID.) In order to make this work, I have set up my grid's store proxy API to have a default read like this:

    With prxy
    .API.Read = Url.Content("~/Assignments/_GetTeams/") + MvcApplication.CurrentApplicationUser.EmployeeID.ToString()
    End With
    To set up parameters for actions I would use StoreParameter with a respective Action.
    <ext:Store runat="server">
        ...
        <Parameters>
            <ext:StoreParameter Action="Read" Name="test" Value="hello!" Mode="Value" />
        </Parameters>
    </ext:Store>
    The list of possible Actions: Read, Create, Update, Destroy.

    Quote Originally Posted by adelaney View Post
    the post definitely has the pagination info in it: http://server/Assignments/_GetTeams/...22ASC%22%7D%5D). However, most importantly, I am trying to figure out how the correct way to handle this scenario.
    I can't see the parameter "e.toString()" in that URL.
    var linkRef = "/Assignments/_GetTeams/" + e.toString();
     App.TeamGrid.store.proxy.api.read=linkRef;
    So, I'm not sure it's a problem request when you are facing broken paging. Are you sure?

    What is the response of the problem request?

    Do you analyse the start and limit parameters on server side to return a respective data for a current page or do you return all data?
    Last edited by Daniil; May 16, 2012 at 7:36 PM.
  3. #3
    The URL I provided has a "null" parameter - which will return all Teams. Other examples are something like:

    ...(e.g. URL - /_GetTeams/1, /_GetTeams/2 - etc...
    which will return teams for employee1 and teams for employee2 - respectively.

    Right now, yes, I am returning all the data. As stated before, most of the result sets are really small. However, there are a few that are a several dozens of rows. (However, in the future, for large grids, I will use the Parameters collection)

    Again, the data is coming back from the post and binding correctly - I have 121 rows. Additionally, the pager at limit of 20 comes back with 7 pages and the first page reports 1-20 or 121 - which is also correct, clicking a navigation button cause a repost to the URL (which brings back all the records again).
  4. #4
    Quote Originally Posted by adelaney View Post
    Right now, yes, I am returning all the data. As stated before, most of the result sets are really small.
    In the case with remote paging you should return from server a data for a current page only analyzing the "start" and "limit" parameters.

    Please note there is remote paging be default if you configure the Store with any type of Proxy.

    You can set up
    RemotePaging="false"
    for the Store if you don't want to deal with remote paging for now.

Similar Threads

  1. Replies: 11
    Last Post: Jun 13, 2012, 4:53 PM
  2. [CLOSED] Problem with paging...
    By RCN in forum 2.x Legacy Premium Help
    Replies: 16
    Last Post: May 29, 2012, 12:22 PM
  3. Problem with paging
    By oseqat in forum 1.x Help
    Replies: 16
    Last Post: Jul 01, 2011, 10:50 PM
  4. [CLOSED] problem with Json Paging.
    By farisqadadeh in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 22, 2011, 5:20 PM
  5. Replies: 1
    Last Post: Oct 09, 2009, 3:46 AM

Tags for this Thread

Posting Permissions