Placing the toolbar of phpGrid at the top of the datagrid for easier access

I am attempting to relocate the toolbar and its icons to the top of the phpGrid Lite datagrid. I found this code in the phpGrid knowledge base:

$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 have replaced $dg with my datagrid name. However, I am confused about the #orders variable. The documentation mentions, "replace "orders" with your own datagrid table name used."

Is the datagrid table name referring to my database table name? I tried using that, but it did not work. Could it be my database's name instead? I attempted that as well, but to no avail. I am uncertain what step to take next.

Answer №1

My solution worked perfectly for me. If your constructor looks something similar to this

$grid = new C_DataGrid("select * from items", "itemCode", "itemcode");

In this case, the table name should be "items". Therefore, swap out "orders" with "items". It's a straightforward fix. Refer to the provided images for clarification. It's possible that you are using an older version.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using the jQuery POST method to execute a redirect upon successful completion

I am attempting to utilize jQuery to create a post method. I have implemented it within a form and used bootstravalidator for validation. Once the form is successfully validated, it is posted and the PHP code comes into action. Now, my goal is to redirect ...

Looping through multi-dimensional JSON objects with jQuery

Hello there, I'm currently facing some challenges in getting the screen below to work properly: Project progress screen I have generated the following JSON data from PHP and MYSQL. My goal is to display the project alongside user images and names whe ...

Custom Native Scrollbar

Currently, there are jQuery plugins available that can transform a system's default scroll bar to resemble the iOS scroll bar. Examples of such plugins include . However, the example code for these plugins typically requires a fixed height in order to ...

Replicate the process of transferring table rows to the clipboard, but exclusively copying the contents

Currently, I am attempting to copy a paginated table to my clipboard by referring to this guide: Select a complete table with Javascript (to be copied to clipboard). However, the issue lies in the fact that it only copies the data from the first page. In ...

I am experiencing issues with the functionality of my ajax form request

I am trying to display an alert message on my page but it doesn't seem to be working. Below is the code from my view: $.ajax({ url :"<?php echo base_url();? >booking/dispatch_challan/DispatchChallanController/createDispatchChallan", ...

What is the best way to use jQuery to dynamically highlight all instances of a word as the user types, both new and existing?

I am currently developing a user-friendly note-taking tool that automatically highlights specific keywords as the user types, making it easier for them to locate important information later on. I have implemented a keyup() function that monitors a text ar ...

the angular-ui-tinymce directive allows for seamless image uploads using a file browser

Utilizing jQuery, we have the ability to incorporate local images into the tinymce editor similar to what is demonstrated in this jsfiddle, by following the guidelines provided in the documentation. The Angular module for tinymce can be found at angular-u ...

What is the process of using AJAX, JavaScript, and HTML to submit data to a remote

I need help with sending data from an HTML page to a server. I have a JSON example below that illustrates what I want to achieve. On my HTML page, I have a question label and four options (A, B, C, D) as radio buttons. After clicking the send button, I ...

What is the best way to display a chosen item in a text input field?

https://i.stack.imgur.com/Qe5Ds.png Looking to create a similar design, but lacking the necessary expertise. What steps should I take or what is the specific term for this style? Seeking assistance in implementing this using jQuery, PHP, or JavaScript. A ...

Tips for maximizing efficiency and minimizing the use of switch conditions in JavaScript when multiple function calls are needed

After coming up with this code a few minutes ago, I began to ponder if there was a more elegant way to optimize it and condense it into fewer lines. It would be even better if we could find a solution that eliminates the need for the switch condition altog ...

Pressing the Add button will create a brand new Textarea

Is it possible for the "Add" button to create a new textarea in the form? I've been searching all day but haven't found any logic to make the "Add" function that generates a new textarea. h1,h2,h3,h4,h5,p,table {font-family: Calibri;} .content ...

Is it possible to create Excel documents containing statistical graphs and pie charts by utilizing PHP and SQL?

I have a database filled with statistical data that I want to export into an excel file. Can anyone recommend any popular libraries or scripts for generating excel files? Additionally, I am interested in displaying some of the dry numerical data in p ...

When implementing datatables in Rails, the Id field integrated with "accepts_nested_attributes_for" functionality suddenly vanishes

Situation: Currently, I am utilizing simple_form to exhibit nested attributes of an association in rails. In order to enhance the edit form for the nested association, I have integrated the jquery-datatables gem using simple_fields_for. Here is a glimpse ...

Having trouble sending information to a servlet with jQuery

As I work on developing an application utilizing jquery in conjunction with servlets, I have integrated the jquery theme roller for enhancing the interface on my Login.jsp page. <script> $(document).ready(function() { $("#dialog").dialog(); }); ...

What is the method or variable called "afterShow" used for in FancyBox V4 and how does it differ from its counterpart in JQuery-FancyBox V3?

We previously utilized the V3 edition of Fancybox, incorporating our increaseImageClicks and increaseVideoClicks functions within its afterShow function: /* FANCYBOX OLD (https://web.archive.org/web/20210325170940/https://fancyapps.com/fancybox/3/docs/): * ...

What could be causing the appearance of a mysterious grey box hovering in the upper left portion of my image and why is the code only adjusting the size of the grey box instead of the entire

I've been working on embedding some JavaScript into my Showit website to create a drag-and-drop feature that displays a collage/mood board effect. Everything is functioning correctly, but I'm running into issues with resizing the images. There&a ...

Can you explain the purpose of App.hiddenDivs in jQuery code snippet provided?

Exploring various JQuery performance tips on this insightful website Do you happen to know the significance of App.hiddenDivs ? ...

When scrolling, use the .scrollTop() function which includes a conditional statement that

As a newcomer to jQuery, I've been making progress but have hit a roadblock with this code: $(window).scroll(function(){ var $header = $('#header'); var $st = $(this).scrollTop(); console.log($st); if ($st < 250) { ...

Place form at the center of the Bootstrap Modal

My question is, how can I center the entire form, including the input fields and labels, within the modal? Here is also a helpful Fiddle: http://example.com, although the snippet provided should work as well. <script src="https://example.com/bootstr ...

Ways to assign the value of an alert to an element

Within this piece of code, my intention is to retrieve the alert value and apply it to an element. Description: The AJAX code I have written checks for values in a database, fetches new values from the database, and then displays these fetched values in a ...