PHP Classes

next page - no where clause

Recommend this page to a friend!

      phpMyDataGrid - AJAX Enabled Datagrid  >  All threads  >  next page - no where clause  >  (Un) Subscribe thread alerts  
Subject:next page - no where clause
Summary:The where clause does not work for the next page.
Messages:2
Author:Chris De_David
Date:2007-08-11 06:44:34
Update:2007-08-11 07:21:10
 

  1. next page - no where clause   Reply   Report abuse  
Picture of Chris De_David Chris De_David - 2007-08-11 06:44:34
Thank you for reading.

Scenario:
I set this up to display all Cities in one State using;
->where = "stateid = '2'"
Note: there are only 1200 cities in that state.

Problem:
When changing pages (using pagination) the grid loses the where stuff and just shows all cities in the entire database, ie. says 10 to 20 of 7543

Does anybody know a fix for this?

Thanks, Chris.

  2. Re: next page - no where clause   Reply   Report abuse  
Picture of Chris De_David Chris De_David - 2007-08-11 07:21:10 - In reply to message 1 from Chris De_David
Hi I fixed this.

What happened is that I was passing a GET variable via the URL to a page containing the Grid. The GET variable includes a "state id", and that is used to create the Where Clause.

How did I fix this?
Well I followed the javascript to see how a page is changed, and noticed that the entire page is reloaded, or a page is called and loaded into a div. None the less, a page is loaded, not just a query to database.

I had to pass the variable back through the 'dg_do' javascript function.
See here that I added 'stateid' to the get parameters being passed to the page call:
parametersAjax = DG_ajaxid+"&stateid="+stateid+"&dg_r="+pgNumber+"&dg_order


Sorry about the explanation, I know this would be complicated to a beginner.

Basically; the problem is within the class... why isn't the where clause being used on the next DG page?

hope this helps another coder :)