Public Variable Archives | phpGrid - PHP Datagrid Create PHP grids in minutes, not hours. Wed, 12 Feb 2020 07:03:29 +0000 en-US hourly 1 CodeProjecthttps://wordpress.org/?v=7.0.3 129966043 $cust_prop_jsonstr https://phpgrid.com/documentation/cust_prop_jsonstr/ Fri, 11 Oct 2013 19:10:31 +0000 http://phpgrid.com/?p=2605 $custo_prop_jsonstr is a variable, not a function. The variable type is JSONString (string in JSON format). The difference between $cust_prop_jsonstr and set_grid_property() is that the later is a function and must take an array as parameter. On the other hand, $cust_prop_jsonstr gives user the power to inject string directly into the jQgrid properties. Which one […]

The post $cust_prop_jsonstr appeared first on phpGrid - PHP Datagrid.

]]>
$custo_prop_jsonstr is a variable, not a function. The variable type is JSONString (string in JSON format).

The difference between $cust_prop_jsonstr and set_grid_property() is that the later is a function and must take an array as parameter. On the other hand, $cust_prop_jsonstr gives user the power to inject string directly into the jQgrid properties.

Which one to use?

The rule of thumb is to use $cust_prop_jsonstr when the property is form of string; else use set_grid_property() function. In general, you want to use set_grid_property().

Remark:

This is an advanced variable. In most cases, you do not need to use it unless you are already very familiar with jQgrid ins and outs that you want to manipulate your grid properties like a code ninja. :)

Example:

1
2
3
4
5
// Here filters must be passed as string to data.php later sent through POST. It's not possible to use set_grid_property function which must take array params
$dg->cust_prop_jsonstr .= 'postData: {filters:
                            \'{"groupOp":"AND","rules":[{"field":"status","op":"eq","data":"Shipped"}]}\'},'
;
// add toolbar to top of the grid.
$dg->cust_prop_jsonstr .= 'toppager:true,';

The post $cust_prop_jsonstr appeared first on phpGrid - PHP Datagrid.

]]>
2605
before_script_end https://phpgrid.com/documentation/before_script_end/ Fri, 11 Oct 2013 18:40:15 +0000 http://phpgrid.com/?p=2603 before_script_end is not a function but a variable. It allows you to inject custom javascript before the end of jqGrid object closing script tag so all DOM elements are presented. This is considered an advanced way to manipulate your grid. The following code snippet demonstrates using this variable to insert a javascript that creates a […]

The post before_script_end appeared first on phpGrid - PHP Datagrid.

]]>
before_script_end is not a function but a variable. It allows you to inject custom javascript before the end of jqGrid object closing script tag so all DOM elements are presented. This is considered an advanced way to manipulate your grid.

The following code snippet demonstrates using this variable to insert a javascript that creates a export dropdown menu on the bottom toolbar.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$dg3 = new C_DataGrid("SELECT * FROM products", "productCode", "products");

$exportDropdown =<<< EXPORTDROPDOWN
$('#products_pager1_left').append ('<div style=padding-right: 16px;>Export:\
    <select onchange=document.location.href=this.options[this.selectedIndex].value;>\
        <option>---</option>\
        <option value=/phpGridx/export.php?gn=products&export_type=excel>Excel</option>\
        <option value=/phpGridx/export.php?gn=products&export_type=pdf>PDF</option>\
        <option value=/phpGridx/export.php?gn=products&export_type=html>HTML</option>\
        <option value=/phpGridx/export.php?gn=products&export_type=csv>CSV</option>\
    </select></div>');
EXPORTDROPDOWN;

$dg->before_script_end = $exportDropdown;
$dg->display();

The post before_script_end appeared first on phpGrid - PHP Datagrid.

]]>
2603