iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hello,
I found a problem that in Chrome or Firefox, if the checkbox cells are set to no editable by using
javascript function "SetForceNoEdit(true)", then double click into the checkbox itsself doesn't trigger
the eventer handler "OnCellDblClick", but if click on the cell where around the checkbox will trigger
the event. My javascript code and the setting of grid is as below.
Could you please give me an idea how to fix this issue.
Thanks,
Mang
<script type="text/javascript">
$(document).ready(function () {
var grid = ISGetObject("OwGrid1");
if(grid)
DisableAllCheckboxCells(grid);
});
function DisableAllCheckboxCells(grid) {
for (var i = 0; i < grid.RootTable.GetRowsCount() ; i++) {
var row = grid.RootTable.GetRow(i);
var cells = row.GetCells();
for (var k = 0; k < cells.length; k++) {
if (cells[k] != null && !cells[k].Column.IsRowChecker && cells[k].Column.ColumnType ==="CheckBox")
cells[k].SetForceNoEdit(true);
}
function dblClick() { alert("double click!"); }
</script>
<IsNet:WebGrid ID="OwGrid1" runat="server" UseDefaultStyle="True" DefaultStyleMode="Elegant" OnInitializeDataSource="OwGrid1_InitializeDataSource">
<RootTable DataKeyField="FIPS" RowHeaders="Yes" RowHeightDefault="20px" Caption="Another Grid" TableHeaderVisible="true" AllowSorting="Yes" AllowEdit="Yes">
<Columns>
<ISNet:WebGridColumn Name="FIPS" DataMember="FIPS"/>
<ISNet:WebGridColumn Name="LastModified" DataMember="LastModified" EditType="CalendarCombo" DataType="System.DateTime" HiddenDataMember="RandomDateTime"/>
<ISNet:WebGridColumn Name="RandomDateTime" DataMember="RandomDateTime" EditType="TextBox" DataType="System.DateTime" Width="-1px"/>
<ISNet:WebGridColumn Name="Post2K" DataMember="Post2K" Width="50px" EditType="Checkbox" ColumnType="CheckBox" Caption="Post 2k"/>
</Columns>
</RootTable>
<LayoutSettings AllowSelectColumns="Yes" AllowFilter="Yes" AllowGrouping="Yes" AllowEdit="Yes" AllowSorting="Yes" AllowColumnSizing="Yes" PagingMode="ClassicPaging" RestoreRowSelection="All" HeaderWrapDefault="True" >
<ClientSideEvents OnCellDblClick="dblClick"></ClientSideEvents>
</LayoutSettings>
</IsNet:WebGrid>
Any advice from your guys?
First, sorry for the delayed response.
Thank you for taking the time to provide details of your question.
The OnCellDblClick client-side event specifies the client-side function to be invoked when a cell is double clicked. The term cell refers to all cell in WebGrid, not specifically for check-box cell. You can try to double click on any cell of WebGrid and the dblClick() method will be invoked.
So, this is not WebGrid issue.
In order to prevent double click on the disabled checkbox column, you can try to enhance the code inside dblClick() method by checking if the cell's ForceNoEdit is true. Following snippet code shows how:
function dblClick(controlId, tblName, rowIndex, cellIndex, cellEl) { var grid = ISGetObject(controlId); var rootTable = grid.RootTable; var selectedRow = rootTable.GetRow(rowIndex); var selectedCell = selectedRow.GetCell(cellIndex - 1); if (selectedCell.ForceNoEdit) return false; alert("double click!"); }
Hope this helps.
Thank you for replying me. Maybe my description is not clear enough, I try to explain my question again.
Firstly, I need to disable the cell (cell.ForceNoedit(true)) when double clicking this cell.
Second, double clicking on the checkbox itself (see img1) doesn't trigger the OnCellDblClick, but double clicking on the other area of the cell (see img2) will trigger this event.
The issue only happen on Chrome and Firefox browsers.
Do you have any advice on it?
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname