Form edit Archives | phpGrid - PHP Datagrid Create PHP grids in minutes, not hours. Fri, 29 Nov 2024 23:55:11 +0000 en-US hourly 1 CodeProjecthttps://wordpress.org/?v=7.0.3 129966043 add_form_group_header() https://phpgrid.com/documentation/add_form_group_header/ Fri, 14 Oct 2016 00:33:59 +0000 http://phpgrid.com/?p=9040 Parameter(s): $before_col_name: Name of column name before which display group header text $text: Group header text Description: Display text before specified column in modal form. Example: 1$dg -> add_form_group_header('employeeNumber', 'Employ Details');

The post add_form_group_header() appeared first on phpGrid - PHP Datagrid.

]]>
  • Parameter(s):
    • $before_col_name: Name of column name before which display group header text
    • $text: Group header text
  • Description:
    • Display text before specified column in modal form.
  • Example:
  • 1
    $dg -> add_form_group_header('employeeNumber', 'Employ Details');

    The post add_form_group_header() appeared first on phpGrid - PHP Datagrid.

    ]]>
    9040
    add_form_tooltip() https://phpgrid.com/documentation/add_form_tooltip/ Fri, 14 Oct 2016 00:33:59 +0000 http://phpgrid.com/?p=9041 Parameter(s): $col_name: Name of column name for the tooltip $tooltip_text: Tool tip text $symbol: Tooltip symbol. Default to (?) with CSS class name “tooltip_sym” Description: Display tool tip for a specified column in modal form. The default tooltip CSS class name is “tooltip_sym”. Example: 1$dg -> add_form_tooltip('email', 'Got mail?');

    The post add_form_tooltip() appeared first on phpGrid - PHP Datagrid.

    ]]>
  • Parameter(s):
    • $col_name: Name of column name for the tooltip
    • $tooltip_text: Tool tip text
    • $symbol: Tooltip symbol. Default to (?) with CSS class name “tooltip_sym”
  • Description:
    • Display tool tip for a specified column in modal form. The default tooltip CSS class name is “tooltip_sym”.
  • Example:
  • 1
    $dg -> add_form_tooltip('email', 'Got mail?');

    The post add_form_tooltip() appeared first on phpGrid - PHP Datagrid.

    ]]>
    9041
    redirect_after_submit() https://phpgrid.com/documentation/redirect_after_submit/ Fri, 14 Oct 2016 00:33:58 +0000 http://phpgrid.com/?p=9042 Parameter(s): $url: Redirect URL Description: Redirect form after submit. Remarks: It does not validate whether the submit is successful. Example: 1$dg -> redirect_after_submit('http://php.net')

    The post redirect_after_submit() appeared first on phpGrid - PHP Datagrid.

    ]]>
  • Parameter(s):
    • $url: Redirect URL
  • Description:
    • Redirect form after submit.
  • Remarks:
    • It does not validate whether the submit is successful.
  • Example:
  • 1
    $dg -> redirect_after_submit('http://php.net')

    The post redirect_after_submit() appeared first on phpGrid - PHP Datagrid.

    ]]>
    9042
    load_form() https://phpgrid.com/documentation/load_form/ Fri, 14 Oct 2016 00:33:58 +0000 http://phpgrid.com/?p=9043 * Paid version only.  Supported from version 7.0 and above. Parameter(s): $key: A database table primary key value. Description: Load an existing record from DB and display in edit form without the datagrid. The form will remain on the screen after submit. Remark: Must call enable_edit(‘FORM’) and form_only() first Only can be used in conjunction with form_only() Example: 1$dg […]

    The post load_form() appeared first on phpGrid - PHP Datagrid.

    ]]>
    * Paid version only.  Supported from version 7.0 and above.

    • Parameter(s):
      • $key: A database table primary key value.
    • Description:
      • Load an existing record from DB and display in edit form without the datagrid. The form will remain on the screen after submit.
    • Remark:
    • Example:
    1
    $dg -> enable_edit('FORM') -> form_only() -> load_form(8888);

    The post load_form() appeared first on phpGrid - PHP Datagrid.

    ]]>
    9043
    Form-Only Edit Mode https://phpgrid.com/example/form-only-mode/ Fri, 14 Oct 2016 00:33:58 +0000 http://phpgrid.com/?p=9044

    * Please note this feature is only available in commercial licenses (7.0+) phpGrid now supports form only mode – displaying the form without showing the grids. It is extremely useful for order entry purpose to collect data from users without giving them access to all your data. Luckily, you can do this with a single line […]

    The post Form-Only Edit Mode appeared first on phpGrid - PHP Datagrid.

    ]]>

    * Please note this feature is only available in commercial licenses (7.0+)

    phpGrid now supports form only mode – displaying the form without showing the grids. It is extremely useful for order entry purpose to collect data from users without giving them access to all your data. Luckily, you can do this with a single line of code.

    The form will remain on the screen after each submit. It also clears the form for the next order entry. You can even enhance the edit form to include group header caption and tooltips.

    Note that you must enable edit and set edit mode to FORM. The form_only method is ignored in INLINE mode.

    1
    $dg -> form_only();

    Live demo!

    The post Form-Only Edit Mode appeared first on phpGrid - PHP Datagrid.

    ]]>
    9044
    Customize Edit Form Layout https://phpgrid.com/example/customize-edit-form-layout/ Thu, 09 Aug 2012 19:21:43 +0000 http://phpgrid.com/?p=2261

    By default, the edit form is displayed a single column table. This is fine for table with small numbers of fields. When you got a large number of fields, the chances are that you want to modify the layout to display multiple columns. Use formoptions property “rowpos” and “colpos” for this purpose. IMPORTANT The column […]

    The post Customize Edit Form Layout appeared first on phpGrid - PHP Datagrid.

    ]]>

    By default, the edit form is displayed a single column table. This is fine for table with small numbers of fields. When you got a large number of fields, the chances are that you want to modify the layout to display multiple columns. Use formoptions property “rowpos” and “colpos” for this purpose.

    IMPORTANT

    • The column order on the edit form, from top to bottom, and left to right, must match EXACTLY as the order in your Sql Select statement. 
    • set_col_required() function should always go BEFORE set_col_property(). This is because an existing bug in jqGrid that adds extra TD tags after the formoptions has been already created that will push everything else to the next line.
    1
    2
    3
    // Always include namespace and conf.php on TOP of the script.
    use phpCtrl\C_DataGrid;
    require_once("/file/path/to/conf.php");

    The following example demonstrates a 2-column edit form.

    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
    28
    29
    30
    31
    $dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders");

    // Required should be called BEFORE set_col_property
    $dg -> set_col_required("orderDate, shippeDate, customerNumber");

    // 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");

    // enable edit
    $dg -> enable_edit("FORM", "CRUD");

    $dg -> set_col_property("orderNumber", array("formoptions"=>array("rowpos"=>1,"colpos"=>1)));
    $dg -> set_col_property("orderDate", array("formoptions"=>array("rowpos"=>1,"colpos"=>2)));
    $dg -> set_col_property("requiredDate", array("formoptions"=>array("rowpos"=>2,"colpos"=>1)));
    $dg -> set_col_property("shippedDate", array("formoptions"=>array("rowpos"=>2,"colpos"=>2)));
    $dg -> set_col_property("status", array("formoptions"=>array("rowpos"=>3,"colpos"=>1)));
    $dg -> set_col_property("customerNumber", array("formoptions"=>array("rowpos"=>3,"colpos"=>2)));
    $dg -> set_col_property("comments", array("formoptions"=>array("rowpos"=>4,"colpos"=>1)));
    $dg -> set_col_property("comments", array("editoptions"=>array("style"=>"width:95%;")));


    $dg->set_form_dimension(700, 400);

    $dg->enable_debug(false);
    $dg -> display();

    Bonus! Set comments field to always have the full width of the form. Please change text “orders” to table name used for your grid.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    <script>
    // Make sure nothing else is sharing the same row!
    $(document).ready(function(){
        var grid=$("#orders");      // your jqGrid (the <table> element)
        var orgEditGridRow = grid.jqGrid.editGridRow; // save original function
        $.jgrid.extend ({editGridRow : function(rowid, p){
            $.extend(p,
                {
                    beforeShowForm : function(form) {
                        form = $(form);
                        $("tr", form).each(function() {
                            var inputs = $(">td.DataTD:has(textarea)",this);
                            if (inputs.length == 1) {
                                var tds = $(">td", this);
                                tds.eq(1).attr("colSpan", tds.length - 1);
                                tds.slice(2).hide();
                            }
                        });
                    }
                });
            orgEditGridRow.call (this,rowid, p);
        }});
    });
    </script>

    Form Layout Screenshot

    Hint: the edit form is resizable by click and drag bottom-right corner using mouse.

    custom form edit layout php datagrid

    See Live Example! (double click a row to see 2-column edit form)

    A sample form layout (from a actual customer):
    realusecase-form-layout

    The post Customize Edit Form Layout appeared first on phpGrid - PHP Datagrid.

    ]]>
    2261
    CRUD PHP Datagrid (Editable Datagrid) * https://phpgrid.com/example/edit-datagrid/ Thu, 16 Sep 2010 23:58:04 +0000 http://64.38.236.7/?p=537 * CRUD PHP Datagrid feature is only available in paid versions.   The PHP datagrid is not editable by default. You can enable edit by simply calling enable_edit(). Currently, two types of edit modes are supported, FORM edit and INLINE. When Form edit mode is used, additional icons appear in the data grid footer for […]

    The post CRUD PHP Datagrid (Editable Datagrid) * appeared first on phpGrid - PHP Datagrid.

    ]]>
    * CRUD PHP Datagrid feature is only available in paid versions.

     

    The PHP datagrid is not editable by default. You can enable edit by simply calling enable_edit(). Currently, two types of edit modes are supported, FORM edit and INLINE. When Form edit mode is used, additional icons appear in the data grid footer for editing. When set to inline mode, the cells in the selected row become editable, and must press Enter key to save changes. Only a single row can be edited for either mode. In FORM edit mode, double click triggers the popup edit window to display. In INLINE edit it is a single click to edit, similar to how Excel works. This is a design decision.

    When edit is enabled in a grid, all of the CRUD operations, Create, Read, Update, and Delete, are supported by default. You can restrict types of edit operations permitted by specifying the second parameter in enable_edit(). For example, to disallow Delete, change it to $operations=’CRU’.

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

    Please note save is disabled in the online demo for security reason.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    $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");

    // enable edit
    $dg -> enable_edit("FORM", "CRUD");

    $dg -> display();

    Update:

    Beginning version 4.4, you can double click to edit whenever edit mode is enabled. The toolbar can also be moved to top with a little javascript. See KB “Move Toolbar to Top of the Grid“.

    The post CRUD PHP Datagrid (Editable Datagrid) * appeared first on phpGrid - PHP Datagrid.

    ]]>
    537