Author Topic: Remote Data  (Read 3073 times)

RedBully

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 51
    • View Profile
Remote Data
« on: July 17, 2015, 04:35:35 pm »
Hello,

I am currently using local data, local header filtering and local sorting in my grid.
I want to start using remote data, remote header filtering and remote sorting and your demos show me how I can do this.

However, in addition to the ObjectModel, ColumnModel and DataModel required by pqgrid, I also use additional meta data about the rows, columns and cells that I store in JSON objects outside of the grid.  This meta data is used to help render the grid (through colModel.render) and for other functionality used outside of the grid.

Question 1: If I implement a URL for handling pqGrid requests for data and filterered data, Should I use dataModel.getData and dataModel.postData so that I can include my own meta data in the request and response sent to the server?

Question 2: Other than some snippets in your demos, do you have documentation on the structure of the JSON objects sent to the server in the case of fetching paged/filtered/sorted data?

In order to use 'remote' data, I will need to create server side classes that I can deserialise the JSON from pqGrid into.  This essentially couples my pqgrid code on the client to server side code in a way that is not currently done and will mean that I have to ensure that my server side code is kept up to date with future releases of pqgrid.

Question 3: I think I would prefer to be able to use a callback method to fetch data instead of having to specify dataModel.Url or dataModel.getUrl.  In this way I can use my own AJAX framework to send and receive both pqgrid data as well as my own meta data and keep the pqgrid code decoupled from the server side code.  Is this currently possible or will you be able to implement this in a future version of pqGrid?

Question 4:  Could I use dataModel.beforeSend to intercept requests and return false.  I can then get beforeSend to carry out my own call to the server and then call 'refreshView' on return.  Does beforeSend have access to the JSON specifying filter and sort information?

Thanks very much






paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6255
    • View Profile
Re: Remote Data
« Reply #1 on: July 20, 2015, 04:24:15 pm »
1. Custom fields of information can be added with dataModel.postData to the existing request being send by grid.

2. I've put up a list of request variables that are send by grid for remote paging, sorting & filtering here:

http://paramquery.com/pro/tutorial#topic-remote-requests

3. The grid code is always decoupled from server side code when you use the grid infrastructure ( dataModel.location = "remote" ) to send and receive data. The grid sends a number of fields to the server as GET and POST variables and it's up to the server how to handle those variables.
« Last Edit: July 20, 2015, 05:41:37 pm by paramquery »