0

I have downloaded PHP Grid from this URL. http://www.phpgrid.org/ (free) I can now connect to db and see the table list and all. Now, what I want to do is, I don't want the user to edit the primary key for each row in Add and Edit functionality. I have went through the forum and FAQ in their website, but still the code is not working Here is my code - The Primary ID SHOULD NOT BE EDITABLE anywhere (inline edit, add & edit functionality).

    <?php
    $conn = mysql_connect("localhost", "root", "password");
    mysql_select_db("test");
    mysql_query("SET NAMES 'utf8'");
    include("inc/jqgrid_dist.php");
    $g = new jqgrid();
    $grid["caption"] = "Book(s)";
    $grid["multiselect"] = false;

    $grid["add_options"]["beforeInitData"] = "function(formid) { $('#list1').jqGrid('setColProp','b_id',{editable:false}); }";
    $grid["add_options"]["afterShowForm"] = "function(formid) { $('#list1').jqGrid('setColProp','b_id',{editable:false}); }";
    $g->set_options($grid);

    $g->set_actions(array(  
                  "add"=>true, // allow/disallow add
                  "edit"=>true, // allow/disallow edit
                  "delete"=>true, // allow/disallow delete
                  "rowactions"=>false, // show/hide row wise edit/del/save option
                  ) 
                    );


    $g->table = "books";
    $out = $g->render("list1");
    ?>

How to make the column b_id not editable. If possible, I will be happy if the inline edit is disabled for all the fields Thanks, Kimz

user3350885
  • 739
  • 4
  • 16
  • 38

1 Answers1

0

Gentleman, Please apologize. I have come across the forum and here is the answer for my query https://phpgrid.desk.com/customer/portal/questions/722675-inline-editing

{snip} You need to override a line in jqgrid_dist.php for that.

old: // double click editing option if ($this->actions["edit"] !== false && $this->options["cellEdit"] !== true) new: // double click editing option if ($this->actions["rowactions"] !== false && $this->actions["edit"] !== false && $this->options["cellEdit"] !== true)

This would enable double click only when rowactions are enabled.

{/snip}

Hope this will help some-one like me. Thanks, Kimz

user3350885
  • 739
  • 4
  • 16
  • 38