Remember multi select while filtering

QuestionsRemember multi select while filtering
Dennis denHollander asked 10 years ago

I am using multi-select with checkboxes, and also using the filter.

I have 14,000 rows in my table, and I need to select about 100 of them.

But I need to be able to filter in different ways, make selections, change filter, etc, and KEEP the selections I make.

Right now, if I make a selection, then type a filter, I lose the selections.

Afterwards I will POST the selected rows to a new PHP page.

6 Answers
Abu Ghufran answered 10 years ago

Yes, it is supported. You need to enable persist settings options.
Refer demos/appearence/persist-settings.php

(I've emailed you link to download v1.5.2)

Dennis denHollander answered 10 years ago

Hi Abu,

Thanks for your help. However, I can't get it working properly.

Here's what I did, using your example page:
1) modify the example persist-settings.php to include multiselect
2) check off id's 8,9,10
3) filter client "maria anders"
4) #9 shows still selected. Good.
5) remove filter "maria anders"
6) only #9 is selected – not 8,9,10 as earlier.

Thanks

Dennis

Abu Ghufran answered 10 years ago

I've resolved this issue.

Please update the new link of 'jqgrid-state.js' in your code.
<script src="http://yourjavascript.com/1331549655/jqgrid-state.js&quot; type="text/javascript"></script>

Live Demo is here:
http://www.phpgrid.org/demo/demos/misc/persist-settings.php

Dennis denHollander answered 10 years ago

Awesome! You're the best!

Abu Ghufran answered 10 years ago

This is supported in full version. If you are using free, it may not work.

BuiDuongThe answered 10 years ago

// Code //
$col = array();
$col["title"] = "Client";
$col["name"] = "client_id";
$col["dbname"] = "clients.client_id";
$col["width"] = "100";
$col["align"] = "left";
$col["search"] = true;
$col["editable"] = true;
$col["edittype"] = "select";
# fetch data from database, with alias k for key, v for value

# on change, update other dropdown
$str = $g->get_dropdown_values("select client_id as k, name as v from clients");
$col["editoptions"] = array(
"value"=>$str,
"onchange" => array("sql"=>"select id as k, note as v from invheader WHERE client_id = '{client_id}'",
"update_field" => "note" )
);

$col["formatter"] = "select"; // display label, not value
$col["stype"] = "select";
$col["searchoptions"] = array("value" => ":;".$str);

$cols[] = $col;

$col = array();
$col["title"] = "Invoices";
$col["name"] = "note";
$col["width"] = "100";
$col["search"] = true;
$col["editable"] = true;
$col["edittype"] = "select";
$str = $g->get_dropdown_values("select id as k, note as v from invheader");
$col["editoptions"] = array("value"=>$str);

$col["editoptions"]["onload"]["sql"] = "select id as k, note as v from invheader WHERE client_id = {client_id}";
$col["stype"] = "select";
$col["searchoptions"] = array("value" => ":;".$str);

$cols[] = $col;
// Code //

When I onchange not working, help fix problem

thanks

Your Answer

20 + 15 =

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?