Saturday, July 22, 2006

Price List Jcpenney Hair Salon

AJAX - Rico LiveGrid: Customizing Lotus Notes

Using Firebug, we can see that Rico sends an Ajax request in the format: data.xml? Openview & id = data_grid & page_size = 70 & offset = 149 & title1 = & sort_col sort_dir = ASC & _ =. It is necessary to change the format of this query to take into account the parameters of standard URL Appeal Notes views.

reminder these parameters are:
  • Start: to set the starting line. It is equivalent to offset. Beware, the offset starts at 0 while the start begins at 1.
  • Count: number of rows to display. It's the equivalent of page_size.
  • ResortDescending = xx or ResortAscending = xx: to force a descending or ascending sort on the column xx. This is equivalent to & & title1 = sort_col sort_dir = CSA. Warning, Rico takes into account the title of the column while Notes expects the number of the column.
For more information about the format of URL for Domino, refer to "Domino URL cheat sheet " of IBM Lotus.

Function prototype object.extend

The URL parameters are encoded in the function of class fetchBuffer RICO.LiveGrid in file rico.js. Not wishing to change the file rico.js I preferred using the function prototype Object.extend. Object.extend
to redefine the function fetchBuffer without having to touch the file rico.js.
To use this function with Rico at the moment must be applied on an instance of the class. This should be corrected in the next version of prototype.

in practice this will give:
  PobreLiveGrid var = new Rico.LiveGrid ("data_grid", 18, 445, 
"data.xml? Openview", opts);
Object.extend (PobreLiveGrid, {
. ..
});
Customizing Notes for RICO.LiveGrid

I copy the function code is defined in RICO only modifies the definition of QueryString in the case of a standard call and in the case a call with a sort column.

The final code is:
  Object.extend (PobreLiveGrid, 
{/ ** *
PobreLiveGrid: * fetchBuffer
LiveGrid for IBM Lotus Notes / Domino
* -------------------------------------------
---------------- * Change the setting of the URL call update
* Data from the table to suit the control URL
* Lotus Notes views. * *

page_size \u0026lt;=> count
* offset \u0026lt;=> start
sortcol * = x & sort_dir AUC = \u0026lt;=> x = ResortAscending
sortcol * = x = DESC & sort_dir \u0026lt;=> x = ResortDescending * * ----------------------------------------------

-------------
* Special thanks to Ross Lawley we Rico Forum

* ** /

fetchBuffer: function (offset) {
if (this.buffer.isInRange (offset) & &
! This.buffer.isNearingLimit (offset)) {
return;}

if (this . processing request) {
this.unprocessedRequest = new Rico.LiveGridRequest (offset);
return;}


was bufferStartPos = this.buffer.getFetchOffset (offset);
this.processingRequest = new Rico.LiveGridRequest (offset);
this.processingRequest.bufferOffset = bufferStartPos;
was fetchsize = this.buffer.getFetchSize (offset);
was partialLoaded = False;

was QueryString;
if (this.options.requestParameters)
QueryString = this._createQueryString (this.options.requestParameters, 0);

QueryString = (QueryString == null)? '': QueryString +'&';

QueryString = QueryString + 'id =' + this.tableId + '& Count =' +
fetchsize + '& start =' + (bufferStartPos +1) + '& offset =' + bufferStartPos;

if (this.sortCol) {
was kind notes =
(this.sortDir == "ASC"? "ResortAscending": "ResortDescending");
QueryString = QueryString +'&'+ varietal notes +'='+ escape (this.sortCol) ;
}

this.ajaxOptions.parameters = queryString;

$ (ajax_call). InnerHTML = queryString;
ajaxEngine.sendRequest (this.tableId + '_request' this.ajaxOptions)

this.timeoutHandler = setTimeout (this . handleTimedOut.bind (this),
this.options.bufferTimeout)

}})
I kept the standard references Rico offset used in the code. This poses no problem to Lotus Notes that ignores this setting.
still remains a problem. We want to retrieve the column number to sort and not its name. Heaureusement LiveGrid offers an option paraméttrage class of very interresting that will not only help address the latter concerns but also allows to restrict the number of columns you want sortable.

must modify the definition opts like this:
 var opts = { 
PrefetchBuffer: false,
onscroll: updateHeader,
sortAscendImg 'sort_asc.gif'
sortDescendImg 'sort_desc.gif'
columns: [ ["1", true], ["3", true], ["5", true], ["7", true], ["9", true]]}
;
parameter columns: [ ["column value ', sortable (true / false)]] should contain all references displayed in columns. He reference "column value" as an identifier for the column instead of its name.

Be very careful because the number of columns displayed on the webpage do not necessarily correspond to the column number of the Lotus Notes view. Thus in the example presented in the previous article ( AJAX - LiveGrid Rico to represent the views Lotus Notes), a two-column was used to define HTML tags which are then interpreted.
The columns contain the values are the odd columns in this case (1, 3, 5, 7, 9). That remains to be returned to Lotus Notes.

To see the code complete, I invite you to read the source code for the example online LiveGrid Rico.

0 comments:

Post a Comment