smartrendering and GET

Hello, we’ve been prototyping with dhtmlxgrid and we’ve been very impressed with your work so far.



I do have a question about enableSmartRendering. It seems to ONLY let me do “GET” as opposed to “POST”, and it seems to ignore any parameters I give it.



Is this an intended behavior or is there a way for me to perform smart rendering via POST? The same question goes for the loadXML() method.



Thanks

By default all load operations uses GET, while there is no way to control such behavior through API, underlaying layer supports POST as well, and it can be switched to POST by small modification

To switch ALL operation to POST , just update dhtmlxcommon.js

    dtmlXMLLoaderObject.prototype.loadXML=function(filePath,postMode,postVars,rpc){
       postMode=true; // this line need to be added


If you need switch some individual operation to POST , you can locate next command

    this.xmlLoader.loadXML(…);

by default command this commands take single parameter - called url, to switch it to post mode it can be updated as<br>
    this.xmlLoader.loadXML(old_url, true, post_vars);

I found that this did not help in the case of smart rendering because smart rendering does not use the function dtmlXMLLoaderObject.prototype.loadXML

Smart rendering actually uses the function “load” which is defined inside of dhtmlxgrid.js

To get smart rendering working using POST, I have done 2 things:

  1. I have switched to using Grid.Post
this.Grid.post(PHPXMLFileNameAndPath,PostArguments);
  1. I have overridden the dhtmlxgrid load function:
this.Grid = dhxLayout.cells("c").attachGrid();
this.Grid.enableSmartRendering(true,50);
this.GridPostArguments = 'Argument1=BlahBlahBlah&Argument2=YattaYattaYatta';
this.Grid.ParentSuperGridAndFilter = this;
this.Grid.load = function(url, call, type){
   this.callEvent("onXLS", [this]);
   if (arguments.length == 2 && typeof call != "function"){
      type=call;
      call=null;
   }
   type=type||"xml";

   if (!this.xmlFileUrl)
      this.xmlFileUrl=url;
   this._data_type=type;
   this.xmlLoader.onloadAction=function(that, b, c, d, xml){
      if (!that.callEvent) return;
         xml=that["_process_"+type](xml);
      if (!that._contextCallTimer)
         that.callEvent("onXLE", [that,0,0,xml]);

      if (call){
         call();
         call=null;
      }
   }

   //******** STANDARD CODE (GET)
   //this.xmlLoader.loadXML(url);

  //******** MODIFIED CODE (PUT)
   var QuestionMarkLocation = url.indexOf('?');
   this.xmlLoader.loadXML(url.substring(0,QuestionMarkLocation), true, this.ParentSuperGridAndFilter.GridPostArguments + '&' + url.substr(QuestionMarkLocation+1)); //POST
}