Preload filter can not generate sql

QuestionsPreload filter can not generate sql
Chengbin Zhu asked 2 months ago

I have encountered an issue when using the preload filter feature on a grid in GridPHP version 2.8 with a MySQL database.
Specifically, when applying the following preload filter:

$sarr = <<< SEARCH_JSON {“groupOp”:“AND”,“rules”:[{“field”:“commodity”,“op”:“in”,“data”:“PHONE”},{“field”:“region”,“op”:“in”,“data”:“AMR”},{“field”:“dtype”,“op”:“in”,“data”:“EWOS”}]} SEARCH_JSON; $opt2[“postData”] = array(“filters” => $sarr);

The SQL query generated by GridPHP is always empty. I enabled debug mode with $grid2->debug_sql = 1 to observe this.
However, if I modify the filter to remove the region field or duplicate it, the SQL query generates correctly without issue. For example, both of the following filters work fine:

$sarr = <<< SEARCH_JSON
{"groupOp":"AND","rules":[{"field":"commodity","op":"in","data":"PHONE"},{"field":"dtype","op":"in","data":"EWOS"}]}
SEARCH_JSON;

$sarr = <<< SEARCH_JSON
{"groupOp":"AND","rules":[{"field":"region","op":"in","data":"AMR"},{"field":"commodity","op":"in","data":"PHONE"},{"field":"region","op":"in","data":"AMR"},{"field":"dtype","op":"in","data":"EWOS"}]}
SEARCH_JSON;

This problem first drew my attention when a user experienced a network connection error after applying various filters. After testing, I confirmed the issue arises during the preload filter process when GridPHP tries to construct the SQL query.
Please advise on how to resolve or further diagnose this behavior.

4 Answers
Abu Ghufran Staff answered 2 months ago

By my guess, it looks like some application middleware is removing certain querystring or post variables, which includes ‘region’. There is no such thing in library not to pass ‘region’ as variable and pass all others.

To debug this, you can debug the $_POST and $_GET and see if its not removed.

error_log(print_r($_POST, true));

Let me know if still now solved.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Abu Ghufran Staff answered 2 months ago

PS: You can put the debug log just before the inclusion of /lib/inc/jqgrid_dist.php in your code.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Abu Ghufran Staff answered 2 months ago

Please send me the database schema to regenerate this case and debug where actually it is gone missing.

You can either send me on live chat or email at [email protected]

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Abu Ghufran Staff answered 2 months ago

Related grid code and database structure will be required to regenerate the case.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

5 + 3 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?