Reputation: 175
I am trying to add an icon to my edit form. The Icon appears as expected but it does not react to click event.
Using free jqGrid 4.13
In the colModel
:
{name:'characteristic', index:'characteristic', width:150, editable: true,
editoptions:{rows:'3',cols:'50'}, editrules:{edithidden:true},
formoptions:{rowpos:3, colpos:1,label:"Characteristic:",
elmsuffix: " <img class='genericnotes' src='/QMSWebApp/Images/addnote[3].jpg'>"},
edittype:'textarea'},
In the loadComplete:
$('.genericnotes').on("click", function(){
var tControl = this.name;
alert(tControl);
//$('.miscdisplay').load("/QMSWebApp/FirstArticleControllerServlet",
//{lifecycle:"faieditlistdisplay",
//tControl:tControl,
//source:0});
//$('.miscdisplay').show("slide", { direction: "right" }, 1000);
});
Upvotes: 0
Views: 73
Reputation: 221997
It's wrong to use $('.genericnotes').on("click", function(){...});
inside of loadComplete
because the edit form is not exist at the moment. You should use for example beforeShowForm
callback of form editing instead. Free jqGrid allows to specify form editing options/callbacks inside of formEditing
option of jqGrid (see the wiki article). Thus you can bind click
handle to the img.genericnotes
by usage of
formEditing: {
beforeShowForm: function () {
$("#characteristic") // select textarea#characteristic
.next(".genericnotes")
.on("click", function () {
alert("Click");
});
}
}
Upvotes: 1