Search Archives | phpGrid - PHP Datagrid Create PHP grids in minutes, not hours. Fri, 06 Dec 2024 02:56:25 +0000 en-US hourly 1 CodeProjecthttps://wordpress.org/?v=7.0.3 129966043 Advanced Search with Date & Number Range Filter https://phpgrid.com/example/advanced-search-date-number-range-filter/ Sat, 13 Aug 2016 02:39:00 +0000 http://phpgrid.com/?p=9025 Advanced search now supports range filter for both date and number. To enable search use enable_advanced_search() method with parameter set to true. Once enabled, the advanced search can be toggled with the advanced search button on the footer. To enable range operators, use set_col_property() to set the “sorttype” to date or integer. 12345678910111213141516171819use phpCtrl\C_DataGrid; require_once("/file/path/to/conf.php"); […]

The post Advanced Search with Date & Number Range Filter appeared first on phpGrid - PHP Datagrid.

]]>
Advanced search now supports range filter for both date and number. To enable search use enable_advanced_search() method with parameter set to true. Once enabled, the advanced search can be toggled with the advanced search button on the footer.

To enable range operators, use set_col_property() to set the “sorttype” to date or integer.

advanced search - number range

advanced search-date range

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use phpCtrl\C_DataGrid;
require_once("/file/path/to/conf.php");  

$dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders");

$dg -> set_col_property("orderDate",
                        array("formatter"=>"date",
                            "sorttype"=>"date",
                            "searchoptions"=>
                                array("dataInit"=>"###datePick###")));

$dg -> set_col_property("customerNumber",
                        array("formatter"=>"integer",
                            "sorttype"=>"integer"));

$dg->enable_advanced_search(true);

$dg->enable_export('EXCEL');
$dg -> display();

Run demo

The post Advanced Search with Date & Number Range Filter appeared first on phpGrid - PHP Datagrid.

]]>
9025
Multiple Fields Global Search * https://phpgrid.com/example/multiple-fields-global-search/ Thu, 12 Mar 2015 15:40:44 +0000 http://phpgrid.com/?p=3582 * Please note global search feature is only available in commercial licenses.   In phpGrid, we always try to make PHP developer’s life easier. So we made global search super simple! A single function call enable_global_search() enables global search on any searchable columns. You can search in one or more searchable columns. Multiple search terms […]

The post Multiple Fields Global Search * appeared first on phpGrid - PHP Datagrid.

]]>
* Please note global search feature is only available in commercial licenses.

Multiple Fields Global Search
Multiple Fields Global Search

 
In phpGrid, we always try to make PHP developer’s life easier. So we made global search super simple! A single function call enable_global_search() enables global search on any searchable columns. You can search in one or more searchable columns. Multiple search terms can be separated by space.

Like the externalize search demo, the search returns data from server side through AJAX and subsequently reloads the grid with newly filtered data without reloading the entire page, except this time is only one line code. No bull.

 

1
2
3
4
5
6
7
// Always include namespace and conf.php on TOP of the script.
use phpCtrl\C_DataGrid;
require_once("/file/path/to/conf.php");  

$dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders");
$dg -> enable_global_search(true);
$dg -> display();

 
See Live Example!

The post Multiple Fields Global Search * appeared first on phpGrid - PHP Datagrid.

]]>
3582
Externalize Search https://phpgrid.com/example/externalize-search/ Thu, 12 Mar 2015 09:31:45 +0000 http://phpgrid.com/?p=3578   You can even externalize search fields without ever using phpGrid’s integrated or advanced search feature. It’s more work but you have the liberal to put the search box anywhere on the page.   This feature requires no PHP, only a little bit of HTML and Javascript. The filters are sent to server side via […]

The post Externalize Search appeared first on phpGrid - PHP Datagrid.

]]>
Externalize Search
Externalize Search

 
You can even externalize search fields without ever using phpGrid’s integrated or advanced search feature. It’s more work but you have the liberal to put the search box anywhere on the page.

 
This feature requires no PHP, only a little bit of HTML and Javascript. The filters are sent to server side via AJAX. It then reloads grid with filtered data without refreshing the entire page.

 
Below code snippet using “orders” table from the previous integrated search example.

 
HTML:

1
2
3
4
5
6
7
<fieldset id="SearchPanel"><legend>Search</legend>Status <input id="status" type="text" placeholder="Enter status" />
<select id="op">
<option value="AND">AND</option>
<option value="OR">OR</option>
</select>
Customer # <input id="customerNumber" type="text" placeholder="Enter customer number" />
<button id="searchbtn"> Search</button></fieldset>

JavaScript:

1
2
3
4
5
6
7
8
9
10
11
function searchGrid(){
phpGrid_orders.setGridParam({
postData: {
filters:'{"groupOp":" '+ $("#op").val() +' ","rules":['+
'{"field":"status","op":"cn","data":"' + $("#status").val() +'"}'+
',{"field":"customerNumber","op":"cn","data":"'+ $("#customerNumber").val() +'"}]}'
},
"search":true,
page:1
}).trigger("reloadGrid");
}

The search operan can have one of the following values:

  • eq: Equals
  • ne: Not Equals
  • lt: Less than
  • le: Less than or Equal
  • gt: Greater than
  • ge: Greater than or Equal
  • cn: Contains
  • nc: Does not Contain
  • bw: Begins With
  • bn: Not Begins With
  • ew: Ends With
  • en: Not Ends With

 
See Live Example!

The post Externalize Search appeared first on phpGrid - PHP Datagrid.

]]>
3578
Advanced Search https://phpgrid.com/example/advanced-search/ Thu, 16 Sep 2010 00:25:00 +0000 http://phpgrid.com/?p=2679 phpGrid also includes advanced search. By default, this feature is not enabled. To enable search use enable_advanced_search() method with parameter set to true. Once enabled, the advanced search can be toggled with the advanced search button on the footer. The advanced search can search on multiple fields simultaneously with different comparison operators. 1234567// Always include […]

The post Advanced Search appeared first on phpGrid - PHP Datagrid.

]]>
phpGrid also includes advanced search. By default, this feature is not enabled. To enable search use enable_advanced_search() method with parameter set to true. Once enabled, the advanced search can be toggled with the advanced search button on the footer.

The advanced search can search on multiple fields simultaneously with different comparison operators.

1
2
3
4
5
6
7
// Always include namespace and conf.php on TOP of the script.
use phpCtrl\C_DataGrid;
require_once("/file/path/to/conf.php");  

$dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders");
$dg->enable_advanced_search(true);
$dg -> display();

See Live Example!

The post Advanced Search appeared first on phpGrid - PHP Datagrid.

]]>
2679
Integrated Search https://phpgrid.com/example/integrated-search/ Thu, 16 Sep 2010 00:20:38 +0000 http://64.38.236.7/?p=505 phpGrid includes integrated search. By default, this feature is not enabled. To enable search use enable_search() method with parameter set to true. Once enabled, the integrated search can be toggled with the search button on the footer.     Notice the “status” is automatically rendered as a drop-down in the integrated search(v5.5+). Talking about making […]

The post Integrated Search appeared first on phpGrid - PHP Datagrid.

]]>
phpGrid includes integrated search. By default, this feature is not enabled. To enable search use enable_search() method with parameter set to true. Once enabled, the integrated search can be toggled with the search button on the footer.

 

Integrated Search

 

Notice the “status” is automatically rendered as a drop-down in the integrated search(v5.5+). Talking about making your life easy? :)

To always display the search toolbar, please see Always display integrated search toolbar on KB.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Always include namespace and conf.php on TOP of the script.
use phpCtrl\C_DataGrid;
require_once("/file/path/to/conf.php");  

$dg = new C_DataGrid("SELECT * FROM Orders", "orderNumber", "Orders");

// change column titles
$dg->set_col_title("orderNumber", "Order No.");
$dg->set_col_title("orderDate", "Order Date");
$dg->set_col_title("shippedDate", "Shipped Date");
$dg->set_col_title("customerNumber", "Customer No.");
 
// hide a column
$dg -> set_col_hidden("requiredDate");

// change default caption
$dg -> set_captin("Orders List");

// set export type and edit select type
$dg -> enable_export('EXCEL');
$dg -> enable_edit('FORM', 'CRUD');
$dg -> set_col_edittype('status', 'select', 'Open:Open;Shipped:Shipped;Cancelled:Cancelled;Disputed:Disputed;On Hold:On Hold');

// enable integrated search
$dg -> enable_search(true);
 
$dg -> display();

See Live Example!

It is possible to externalize search command using Javascript. Check out Externalize Search Example.

The post Integrated Search appeared first on phpGrid - PHP Datagrid.

]]>
505