- Mon Jul 16, 2018 2:25 pm
#815196
Hi,
Is there a way to read a click on the entire row in a grid? not just in a element inside a row.
and also I want to add style to that row on mouseover, For example add background color on mouseover to the row.
Currently I have a javascript code to read a click in the ID textbox inside the row, but I want to click on any part of the row
Is there a way to read a click on the entire row in a grid? not just in a element inside a row.
and also I want to add style to that row on mouseover, For example add background color on mouseover to the row.
Currently I have a javascript code to read a click in the ID textbox inside the row, but I want to click on any part of the row
Code: Select all
Thanks in advancevar gridId = "grid"; //set to the ID of the grid
var fieldId = "Name"; //set to the ID of the field in grid
//set click event handler when the DynaForm loads for any existing rows in the grid:
var nRows = $("#"+gridId).getNumberRows();
for (var i = 1; i <= nRows; i++) {
$("#\\["+gridId+"\\]\\["+i+"\\]\\["+fieldId+"\\]").click(clickHandler);
}
//set click event handler when a new row is added:
$("#"+gridId).onAddRow(function(aNewRow, oGrid, rowIndex) {
$("#\\["+gridId+"\\]\\["+rowIndex+"\\]\\["+fieldId+"\\]").click(clickHandler);
});
//click event handler function to display an alert if the field is left empty:
function clickHandler() {
var rowNo = $(this).prop("id").match(/\]\[(\d+)\]\[/)[1]
var val = $(this).find("input.form-control").val();
if (val != '') {
//alert("Click on row number "+rowNo);
//alert("Row "+val+" needs to be filled.");
var vulnId = $("#grid").getValue(rowNo, 1)
alert("Name "+ vulnId);
$("#9632281615b4c9a5278f055089913739").showFormModal();
$("#9632281615b4c9a5278f055089913739").submitForm()
$("#9632281615b4c9a5278f055089913739").hideFormModal();
}
}
Attachments
Selection_383.png (47.07 KiB) Viewed 6505 times