I'm currently working with a grid that has checkboxes in first column, I'm using row edit templates, but I want to ignore the call to the row edit template on the checkbox column, because right now if I click the checkbox with the row selected it will fire the event.
Thank you,
Cláudio Correia
Hi Claudio,
I assume the default cell click action is set to Edit. So it opens the RowEditTemplate after you click the checkbox, right? If you don't want to open the RowEditTemplate, then the BeforeEnterEditModeHandler should be included on the client side. To include the handler, open the properties window for WebGrid, then expand DisplayLayout --> ClientSideEvents and click on the event and select add a new handler. This will create the javaScript method signature in the HTML source page. Now you can add code to handle the event. Here is a sample:
function UltraWebGrid1_BeforeEnterEditModeHandler(gridName, cellId)
{
//Add code to handle your event here.
var col = igtbl_getColumnById(cellId);
if(col.HeaderText == 'CheckBoxColumn')
return(true);
}
This way when the cells in the CheckBoxColumn are clicked, the RowEditTemplate doesn’t open.
I hope this helps.
Thanks
Thank you for the reply, I'm not using the cellclickaction="Edit" property, the rows launch the edit template on a second click on the row. I tried using the solution you sugested by the event doesn't get fired, this is how I declared it:
<ClientSideEvents BeforeEnterEditModeHandler="uwg1_BeforeEnterEditModeHandler"></ClientSideEvents>
But nothing is happening, I put a "alert('test')" inside the function but it never reaches it.
Do I need to had something else to the grid?
While doing some tests with a single grid I found that this event wont fire when I have AllowUpdateDefault="RowTemplateOnly"...any way to go around this problem?
I was wondering what the check box column is doing. If clicking on this makes the RowEditTemplate open, then something is forcing the row to get to edit mode. The property I mentioned earlier is:
UltraWebGrid1.DiaplayLayout.CellClickActionDefault = CellClickAction.Edit;
If you are not using this, then the row goes to edit mode only when double clicked and should open the RowEditTemplate.
Please specify what the CheckBox column is supposed to do and what kind of other columns are there.
I'll try to explain the situation better.
The checkbox doesn't do anything besides getting checked or unchecked, it's used with a delete button which checks the grid to see which rows are selected to delete them.
Like I said I'm not using the CellClickAction property, it fires the row edit template on a second click on the row, but I don't want it to fire for the checkbox
The other columns are normal ultragridcolumns, they only receive the text from the row template
Hi,
In other words you want to disable the double click action on the check box column, right? If so, then you can handle the doubleclick event on the client side as follows:
Function UltraWebGrid1_DblClickHandler(gridName, cellId)
var grid=igtbl_getGridById(gridName);
var cell = igtbl_getCellById(cellId);
if(cell.Column.Index==0) //the first column is the checkbox column
else
grid.beginEditTemplate();
This way it will not send the row to enter edit mode when the check box column is clicked twice.
Hope this helps.
I tried what you said, but this problem is getting more frustrating every moment I try to do something. Right now the edit row template will show on the second click of a row, not necessarily a double click.
I also tried the cellclickhandler event, to see if I could capture which column was chosen and try to do something from there, but no luck, the edit row fires before anything.
I would like to know if there's any way to prevent a row selection, because right now if I click a second time on the selected row, it will fire the event, if I don't have any selected everything works fine.
I think this issue needs a closure look. Please attach a sample here after compressing it in .zip format or submit a support request with the sample @ http://ko.infragistics.com/support/default.aspx#Overview or you can send an email to support@infragistics.com . I would like to see what's going on in the code before suggesting you to do anything else.
Sarita