jqModal displays previous form when invoked subsequent times

QuestionsjqModal displays previous form when invoked subsequent times
Rick Stevens asked 9 years ago

I am having an issue with the jqModal setting when invoked multiple times. For example, here is a test page that demonstrates the issue.

http://sonoma-dev.webreliance.com/jqmodal_issue.php

Select a row and click the edit icon.
Cancel
Now select a different row and click the edit icon.

You will see that the modal that opens is the first modal, not the modal that should be displaying for the row currently selected.

If I set jqModal to True, this issue does not exist, but then clicking off add/edit form closes the form, which my client does not like. Any help you can provide would be greatly appreciated!

Here is the php code:

<?php include '_db.php' ?>
<?php include("lib/inc/jqgrid_dist.php"); ?>

<?php
// include and create object
//include("lib/inc/jqgrid_dist.php");
$ng = new jqgrid($db_conf);

// set few params
$ngrid["autowidth"] = true;
$ngrid["height"] = "175";
$ngrid["form"]["position"] = "center"; // position form dialog to center
$ngrid["sortname"] = 'notedate';
$ngrid["sortorder"] = "desc";
$ngrid["add_options"] = array('width'=>'420',"recreateForm"=>true,"jqModal"=>false);
$ngrid["edit_options"] = array('width'=>'420',"recreateForm"=>true,"jqModal"=>false);
$ngrid["altRows"] = true;
$ngrid["altclass"] = "myAltRowClass";

$ng->set_options($ngrid);

$ng->set_actions(array("delete"=>true, "add"=>true, "edit"=>true, "rowactions"=>false));

// set database table for CRUD operations
$ng->table = "data_Note";

$sql = "select noteid, noteguid, clientid, notedate, note from data_Note where clientid = 1 ";
$ng->select_command = $sql;

$col = array();
$col["title"] = "Note ID"; // caption of column
$col["name"] = "noteid"; // grid column name, same as db field or alias from sql
$col["width"] = "10"; // width on grid
$col["hidden"] = true;
$ncols[] = $col;

$col = array();
$col["title"] = "Note GUID"; // caption of column
$col["name"] = "noteguid"; // grid column name, same as db field or alias from sql
$col["width"] = "10"; // width on grid
$col["hidden"] = true;
$ncols[] = $col;

$col = array();
$col["title"] = "clientid";
$col["name"] = "clientid";
$col["editable"] = true;
$col["editoptions"] = array("defaultValue"=>1, "recreateForm"=>true);
$col["show"] = array("list"=>false,"edit"=>false,"add"=>false);
$ncols[] = $col;

$col = array();
$col["title"] = "Date";
$col["name"] = "notedate";
$col["width"] = "6";
$col["editable"] = true; // this column is editable
$col["editoptions"] = array("style"=>"width:150px;","defaultValue"=>date('m/d/Y'), "recreateForm"=>true); // with default display of textbox with size 20
$col["editrules"] = array("required"=>true, "edithidden"=>true); // and is required
# format as date
$col["formatter"] = "date";
# opts array can have these options: http://api.jqueryui.com/datepicker/
$col["formatoptions"] = array("srcformat"=>'Y-m-d',"newformat"=>'m/d/Y');

//$col["link"] = "http://localhost/?id={id}"; // e.g. http://domain.com?id={id} given that, there is a column with $col["name"] = "id" exist
//$col["linkoptions"] = "target='_blank'"; // extra params with <a> tag
$ncols[] = $col;

$col = array();
$col["title"] = "Note";
$col["name"] = "note";
$col["width"] = "20";
$col["resizable"] = true;
$col["editable"] = true;
$col["edittype"] = "textarea";
$col["editoptions"] = array("rows"=>4, "cols"=>40);
$ncols[] = $col;

$ng->set_columns($ncols);

// render grid
$noteout = $ng->render("notelist");

?>
<?php include '_funcs.php' ?>
<?php include '_header.php' ?>
<?php echo $noteout; ?>

2 Answers
Abu Ghufran answered 9 years ago

Try setting, jqmodal and modal both to true.

$grid["add_options"] = array('width'=>'420',"recreateForm"=>true,"jqModal"=>true,"modal"=>true);
$grid["edit_options"] = array('width'=>'420',"recreateForm"=>true,"jqModal"=>true,"modal"=>true);

Rick Stevens answered 9 years ago

That solved it! Thank you for the excellent support.

Your Answer

18 + 14 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?