dropdown not filtering gird

Questionsdropdown not filtering gird
mike asked 10 years ago

have a dropdown that uses creates a list of values from the grid. When selecting any value from the dropdown, the grid refreshes but does not filter. Am I missing someting?

6 Answers
Abu Ghufran answered 10 years ago

Perhaps, you are missing dbname property.

$col["dbname"] = "invheader.client_id"; // this is required as we need to search in name field, not id

Refer demos/appearance/dropdown.php for code sample in your licensed pack.

mike answered 10 years ago

I do ave that,code isbelow
// begin dropdown cloumn
$col = array();
$col["title"] = "Grade";
$col["name"] = "Grade";
$col["dbname"] = "Grade"; # incase of conflict of field name in query, use exact table.field to search in
$col["width"] = "15";
$col["align"] = "left";
$col["search"] = true;
# fetch data from database, with alias k for key, v for value
$grade_lookup = $g->get_dropdown_values("select distinct grade as k, grade as v from Web_BoneyardTable where grade = 'SP300' or grade = 'SP350' or grade = '41X40' or grade = '00P20' or grade = 'P20HH' or grade = 'SP400' or grade = 'MEC75' or grade = 'MEC90' or grade = 'HP370'");
# these 3 lines will make dropdown in search autofilter
$col["stype"] = "select";
// blank row, then all db values – ; is record separator, : is key-value separator
$col["searchoptions"] = array("value" => ":;".$grade_lookup);
$col["editable"] = false;
$col["edittype"] = "select"; // render as select
$col["editoptions"] = array("value"=> $grade_lookup); // with these values "key:value;key:value;key:value"
$cols[] = $col;
//end dropdown

Abu Ghufran answered 10 years ago

Hi,

Also paste the ->select_command query as it is actually used in searching.
and ->table property.

mike answered 10 years ago
Abu Ghufran answered 10 years ago

Try setting:

$g->select_command = "select * from [pltdata].[dbo].[Web_BoneyardTable] where grade = 'SP350' or grade = 'SP300' or grade = '41X40' or grade = '00P20' or grade = 'P20HH' or grade = 'SP400' or grade = 'MEC75' or grade = 'MEC90' or grade = 'HP370'";

to

$g->select_command = "select * from [pltdata].[dbo].[Web_BoneyardTable] where (grade = 'SP350' or grade = 'SP300' or grade = '41X40' or grade = '00P20' or grade = 'P20HH' or grade = 'SP400' or grade = 'MEC75' or grade = 'MEC90' or grade = 'HP370')";

use ( ) in where or condition group. looks like additional query is just AND'ing to last grade=hp370 condition.

mike answered 10 years ago

Once again your stellar service comes through, even fixed a second pronlem I had with exporting the grid to PDF. can't thank you enough.

Your Answer

6 + 9 =

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?