Image & double click

QuestionsImage & double click
Massimo Gagliardi asked 10 years ago

I added the functionality to open the edit dialog by double clicking on the grid master rows, where I also have an image column ($ col ["EditType"] = "file").
When I open the edit window with a click on the edit icon is ok, but if I open with a double click on the image column then in the edit dialog doesnt appear the image path and the delete button but only a text box in which there is the image name.
How can I do?
Thanks in advance

7 Answers
Abu Ghufran answered 10 years ago

If you are showing image in grid list, you should use a virtual column (with editable -> false).

e.g.

$col = array();
$col["title"] = "Logo";
$col["name"] = "logo";
$col["width"] = "80";
$col["align"] = "center";
$col["search"] = false;
$col["sortable"] = false;
$col["export"] = false;
$col["default"] = "<img height=50 src='http://domain.com/images/{custom_image}'>";
$cols[] = $col;

Default setting is editable -> false.

Now when you double click on it, it won't change to textbox and rest function will work as before.

You can refer demos/appearance/image.php for code / demo.

Massimo Gagliardi answered 10 years ago

I used this (to upload the article's images in the server):

$col = array();
$col["title"] = "Photo";
$col["name"] = "Foto";
$col["width"] = "20";
$col["editable"] = true;
$col["edittype"] = "file";
$col["upload_dir"] = "foto";
$col["search"] = false;
$col["sortable"] = false;
$col["show"] = array("list"=>true,"edit"=>true,"add"=>true);
$cols[] = $col;

$upload_url = explode("/",$_SERVER["REQUEST_URI"]);
array_pop($upload_url);
$upload_url = implode("/",$upload_url)."/";

$col = array();
$col["title"] = "Photo";
$col["name"] = "xFoto";
$col["dbname"] = "hmr_own_articoli.Foto";
$col["width"] = "18";
$col["editable"] = true;
$col["sortable"] = false;
$col["align"] = "center";
$col["condition"] = array('$row["Foto"] == ""', "<img height=80 src='images/blank.png'>", "<a class='fancybox' href='$upload_url/{Foto}' target='_blank'><img width=100% height=80 src='$upload_url/{Foto}'></a>");
$col["show"] = array("list"=>true,"edit"=>false,"add"=>false);
$col["export"] = false;
$cols[] = $col;

you can upload the image regulary by the add dialog, then you will view the row with the photo and …

you can delete it from edit dialog, but only if you use the standard edit mode (by clicking on edit icon)
If you use the double click in the edit dialog doesnt appear the image path and the delete button but only a text box in which there is the image name

Abu Ghufran answered 10 years ago

Hello,

Try setting "list"=>false, in Foto column.

$col["name"] = "Foto";

$col["show"] = array("list"=>false,"edit"=>true,"add"=>true);
$cols[] = $col;

Also send me issues screenr.com link or screenshot link.

Massimo Gagliardi answered 10 years ago

Here is a screencast: http://www.screenr.com/iHmN

Abu Ghufran answered 10 years ago

Make sure you are passing 3rd argument (edit options) when enabling double click row function.
$g is grid object – new jqgrid().

<script>
var opts = {
'ondblClickRow': function (id) {
jQuery(this).jqGrid('editGridRow', id, <?php echo json_encode_jsfunc($g->options["edit_options"])?>);
}
};
</script>

Massimo Gagliardi answered 10 years ago

This is my call:
var opts = {
'ondblClickRow': function (id) {
var rowid = jQuery(this).jqGrid('getGridParam','selrow');
jQuery(this).jqGrid('editGridRow', rowid, <?php echo json_encode_jsfunc($g->options["edit_options"])?>);
}
};
it's same of your.
do you have some other suggestion?

Abu Ghufran answered 10 years ago

Emailed you working demo.

Your Answer

20 + 8 =

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?