Is there any way of handling the Add New Row Selector Image click event? I can't seem to find one. My users keep wanting to click it with the mouse, and they expect something to happen. It would be great if I could handle the image click event with Javascript and activate the first cell in the Add New Row.
Hello chhiii,
There is no build in functionality for handling the required by you event.
The image that is displayed in the add new row part of the grid is actually visible only if row selectors are enabled.
However the image actually is rendered in one <div> element and you can use this element to handle the click event with a jQuery function:
// subscribe for jQuery methods
<script src="http://code.jquery.com/jquery-1.5.js"></script>
// create function that will simulate click on the div element
function GetDivElement() {
$('div[class|="igg_AddNewRowSelectorImageCssClass"]').click('', processEventInfo);
}
// handle the click event and simulate click on the add row first element
function processEventInfo(eventElement) {
var grid = $find('WebDataGrid1');
var element = grid.get_behaviors().get_editingCore()._behaviors._rowAdding._row.get_cell(0).get_element().click();
// start the event when user click on the page body
<body onmousedown="GetDivElement()">
This code can help you to achieve the required by you behavior.
Let me know if you have further questions.
Hi Alex,
I am not seeing the Add button or the Add Image in the Add new row, how to add it ?
I have a Add new row and when i place the mouse i can enter the text in the textbox and when i click the tab button it is creating a new row , but i want this to happen like as below.
Place the Add button in the Add New Row and then only when they click on the Add New button add the new row and not on tab click
I have successfully done this for one grid, however now I am trying to use this for a Hierarchial grid where I am adding rows to the child grids.
For that I need to know which RowIsland I have cilcked on. How can I get this info from clicking on the row selector image in the add new row?
Alex - thank you so, so much!!!