Re-render with URL params

11 views
Skip to first unread message

chris

unread,
Sep 25, 2010, 1:27:41 PM9/25/10
to MyTableGrid
Hi there,

How would you dynamically add or change URL params when rendering. I
want to apply filters to the grid, but I've only managed to apply
params (that affect what is displayed) on the original render... If I
try to render again, I get a new grid ?!?
Perhaps this is the not the way to do it... I've tried applying rules
after the render and simply refreshing the content but that does not
seem to work... new rows and delete rows update on refresh, but I cant
seem to apply filters to existing rows dynamically.

Thanks,
Chris

Pablo Aravena

unread,
Sep 25, 2010, 9:13:51 PM9/25/10
to mytab...@googlegroups.com
Hi Chris

I think you can use the request object included when you define your table model:

var tableModel = {
     columnModel : [
          .....
     ],
     request : {
           filter1 : 'value1',
           filter2: ''value2',
           ....
     }
}

var tableGrid = new MyTableGrid(tableModel);
tableGrid.render('table1');


tableGrid.request['filter3'] = 'value3'  // You can access the request directly from tableGrid object
tableGrid.refresh();


I hope It works :-D

Have an excellent day
and don't forget to support my work ;-)


Regards
Pablo




--
You received this message because you are subscribed to the Google Groups "MyTableGrid" group.
To post to this group, send email to mytab...@googlegroups.com.
To unsubscribe from this group, send email to mytablegrid...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mytablegrid?hl=en.


infringer

unread,
Sep 29, 2010, 3:26:17 PM9/29/10
to MyTableGrid
Just found MyTableGrid and am loving it! Great piece of software...
documentation lacks a little bit, but nothing too hard to handle.

I needed a way to regen parameters on the fly as well. Here is my
solution:

In the initialize function in tablegrid.js, just below the line
"this.name = tableModel.name || '';" add a line that looks like this:
this.paramRegen = tableModel.paramRegen || null;

Then in the _retrieveDataFromUrl function, just below the line "var
self = this;" add the following:
params = self.request;
if (self.paramRegen != null) {
regenParams = self.paramRegen();
Object.extend(params, regenParams);
}

And just below that in the Ajax.Request, change the "parameters:
self.request," to "parameters: params,"

Then in the table model, you can supply a paramRegen function like so:
url: 'modules/admin/user/getUserTable.php',
paramRegen: function () {
var thisItem = new Object;
thisItem.showAll = CFescape($F('show_all'));
return thisItem;
}

Hope this helps someone else! I can upload the tablegrid.js file if
it would be of help.

-David
> > "MyTableGrid" group.> To post to this group, send email tomyta...@googlegroups.com.
> > To unsubscribe from this group, send email to>mytablegrid...@googlegroups.com<mytablegrid%2Bunsubscribe@googlegr oups.com>
> > .
Reply all
Reply to author
Forward
0 new messages