0

I'm trying to move the toolbar and its icons to the top of the phpGrid Lite datagrid. From the phpGrid knowledge base, I got this code:

$dg->cust_prop_jsonstr = 'toppager:true,';
$dg->before_script_end = '
        jQuery("#orders")
                    .navSeparatorAdd("#orders_toppager_left",{
                        position:"first"
                    })
                    .navButtonAdd("#orders_toppager_left",{
                        caption:"Advanced Search  ",
                        title:"Advanced Search",
                        buttonicon:"ui-icon-search",
                        onClickButton: function(){
                            jQuery("#orders").jqGrid("searchGrid", {multipleSearch:true,showQuery:true});
                        },
                        position:"first"
                    })
                    .navSeparatorAdd("#orders_toppager_left",{
                        position:"last"
                    })
                    .navButtonAdd("#orders_toppager_left",{
                        caption:"Export to Excel  ",
                        title:"Export to Excel",
                        buttonicon:"ui-icon-extlink",
                        onClickButton: function(){
                            jQuery("#orders").jqGrid("excelExport",{url:"../export.php?dt=json&gn=orders&export_type=EXCEL"});
                        },
                        position:"last"
                    })
                    .navSeparatorAdd("#orders_pager1_left",{
                        position:"first"
                    })
                        .navButtonAdd("#orders_pager1_left",{
                            caption:"Advanced Search  ",
                            buttonicon:"ui-icon-search",
                            onClickButton: function(){
                                jQuery("#orders").jqGrid("searchGrid", {multipleSearch:true,showQuery:true});
                            },
                            position:"first"
                        });

                        (function($) {
                            $.rand = function(arg) {
                                if ($.isArray(arg)) {
                                    return arg[$.rand(arg.length)];
                                } else if (typeof arg === "number") {
                                    return Math.floor(Math.random() * arg);
                                } else {
                                    return 4;  // chosen by fair dice roll
                                }
                            };
                        })(jQuery); ';

I've replace $dg with my datagrid name. But the #orders variable is what's throwing me. The documentation says, "replace "orders" with your own datagrid table name used."

Is the datagrid table name my database table name? I tried that, and it didn't work. Is it my database's name? I tried that, too, and it didn't work. I'm at a loss.

LauraNMS
  • 2,720
  • 7
  • 39
  • 73

1 Answers1

2

It works for me. If your constructor is something like this

$dg = new C_DataGrid("select * from products", "productCode", "productcode");

Then the table name is "products". So replace "orders" with "products". Simple as that. See images. Maybe you use a previous version.

enter image description here

KSchoniov
  • 416
  • 4
  • 10