Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Customise server access
16/10/2009
01:51
Avatar
hawkettc
Member
Members
Forum Posts: 3
Member Since:
16/10/2009
sp_UserOfflineSmall Offline

Hi,

   I am assessing jqGrid for my project, and have come across some things that may be an issue for me - but perhaps I am misunderstanding jqGrid.  I have two questions

1.  RESTful URI - I have a few reasons to take control of the ajax request - one because the URL may change - e.g. in the TreeGrid, each set of children come from a different URL - ( in REST, a resource, or collection of resources should have a unique URI), so when I open a tree node, I do not want a GET parameter specifying the parent, I use a different URL.  A second reason is that I have a client side data access framework in place already - it takes care of many things, including caching data (for example).  I use this framework in many other situations apart from jqGrid.  I am wondering if it is possible/easy to take responsibility for the actual $.ajax() call - e.g. could I provide a function instead of a URL?  This function would take a standard set of parameters specified by jqGrid and return data in the required format.  I can then manipulate the URL to my liking, as well as use my own data access framework.

2. HTML rendering - I have seen the tableToGrid module - will this work with the treegrid?

Thanks,

Colin

17/10/2009
06:45
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

1. Look at what is new in 3.6. Thi is exactley what you want. Now the developer can serialize the data in a way that they want

2. Not directly. Maybe you will need to get the data from the table in appropriate format and tup it with addJSONData

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

18/10/2009
00:58
Avatar
hawkettc
Member
Members
Forum Posts: 3
Member Since:
16/10/2009
sp_UserOfflineSmall Offline

I took a look at the 'Ajax Improvements' demo for 3.6, and specifically the serializeGridData, which appars to be designed to modify the request data prior to the $.ajax() call – however the following options in that example still appear to control the actual $.ajax() request itself -

ajaxGridOptions : {type:”POST”},

url:'server.php?q=2'

I may have misunderstood the example, but it wasn't clear to me how I would use this mechanism to modify the request URL, or to use my own framework to make the $.ajax() call – is it possible to remove the above two options completely, so that jqGrid is not responsible for making the call?  e.g.

jQuery(”#jqgajax”).jqGrid({

  getData: function (requestData, callback) {

    $.ajax({

      type: “GET”,

      url: “/myURL”,

      data: requestData,

      dataType:”xml”,

      complete: function(xmlResponse) {callback(xmlResponse);}

    });

  },

  dataType: “xml”,

  colNames: …,

  colModel: …,

  …

}

I may have missed some documentation, but I am also aware that 3.6 has only just been released, and the documentation for what I am looking for may not yet be available – thanks,

Colin

18/10/2009
03:53
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

I'm not sure if you read the docs, but in principe you have to choice two possibilities:

1. Completley use your own request with options and callbacks what you want. This can be achieved using the grid option datatype as function

See documentation:

datatype : function (postdata) {

// here you jax code or what you want

$.ajax({..

complete: function(...) {

var data = .....

var mygrid  = $("#mygrid")[0];

mygrid.addJSONData(data);

// or mygrid.addXMLData(data);

}

});

}

...

2. To easy the proces we have created a serialize function. The purpose of this function is to serialize the data posted to the server (By example in json string or xml string). In this case the developer should use your own method to do this.

Example:

onserializeGridData  : function (postdata) {

var mypost = JSON.stringify(postdata);

return mypost; // this is JSON string

}

Hope this help

Best Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

18/10/2009
05:26
Avatar
hawkettc
Member
Members
Forum Posts: 3
Member Since:
16/10/2009
sp_UserOfflineSmall Offline

Hi Tony,

  My bad for missing that in the docs - where it is described clearly.  Thanks for the details, that sorts out my main problem completely,

Colin

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
60 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information