Hi. I want my row when clicked doing some function, but i want another field of row doing something else when clicked. Is It possible?
Consider the exception field as button.
Thanks for your attention.
If you would put the button into the field, you could just return false from the click handler, so the event won't go to the row:
$("<button>").click(function() {
// some action
return false;
});​
If you wish to handle the click on the entire table cell, you could redefine rowClick in grid config:
rowClick: function(args) {
var $target = $(args.event.target);
if($target.closest(".your-field-css-class").length) {
// handle cell click
}
// otherwise handle row click
if(this.editing) {
this.editItem($target.closest("tr"));
}
},
Yes, returning false on click works, Thank you very much for your support.
You are welcome!
Hi, I'm new with this library. Where exactly should I put the code?
Hi, I'm new with this library. Where exactly should I put the code?
which one?
If you mean click function of row, it is a variable when you initialize grid.
If you mean the button or some element inside row, you must define click event for that element.
Hi, I'm new with this library. Where exactly should I put the code?
which one?
If you mean click function of row, it is a variable when you initialize grid.
If you mean the button or some element inside row, you must define click event for that element.
I put the event, but it does not work ``{ name: "CodigoCurriculo", type:"text", visible:false},
{ name: "Nombre", type:"text",title: "Curriculo",},
{ name: "Autor", type:"text",rowClick: function(args) {
alert("Hola")
}},
{ name: "Temas", type: "select", items: TemasSelect },
This is a sample, i wish it could help.
container.jsGrid({
inserting: false,
editing: false,
sorting: false,
paging: false,
data: data,
fields: [
{name: "instrumentID", itemTemplate: function (value, item) {
return value;
}
},
],
rowClick: function (args) {
selectShare(args.item.instrumentID);
}
});
Esta es una muestra, ojalá pudiera ayudar.
container.jsGrid({ inserting: false, editing: false, sorting: false, paging: false, data: data, fields: [ {name: "instrumentID", itemTemplate: function (value, item) { return value; } }, ], rowClick: function (args) { selectShare(args.item.instrumentID); } });thanks for your reply. It has helped me a lot. I only have one concern: the code that you have placed works for me to place the event in the whole row. I want to add the event to only one field.