DhtmlXGrid 的 LinkButtons 在 SplitAt() 之后不工作
DhtmlXGrid's LinkButtons are not working after SplitAt()
我有一个 DhtmlXGrid,它具有 Link 按钮和排序功能。一切正常,但是,我最近添加了 splitAt() 以支持固定列,在此之后 link 按钮 onClick 在单击网格 headers 进行排序后未被调用。下面是我的代码,
function initGrid() {
setGridSize();
gridMenu.setIconsPath('..');
gridMenu.setImagePath('..);
gridMenu.renderAsContextMenu();
gridMenu.attachEvent('onClick', onButtonClick);
gridMenu.loadXML('..');
grid.setIconsPath('@urlDhtmlxImages');
grid.setImagesPath('@urlDhtmlxImages');
grid.enableContextMenu(gridMenu);
grid.attachEvent("onBeforeContextMenu", onShowMenu);
grid.setSkin('dhx_black');
grid.enableColumnAutoSize(false); // Double-click header will size to fit
// grid.attachEvent("onBeforeSorting", onBeforeSort);
grid.attachEvent("onEditCell", onEditCell); // Edit Cell
//grid.attachEvent("onCellMarked", onCellChanged);
var combobox1 = grid.getCombo(4);
combobox1.put("Yes", "Yes");
combobox1.put("No", "No");
var combobox2 = grid.getCombo(5);
combobox2.put("Yes", "Yes");
combobox2.put("No", "No");
//grid.enableSmartRendering(true);
//grid.attachEvent("onDhxCalendarCreated", createCalender);
grid.init();
grid.splitAt(1);
grid.load('...', FillGirdDataOnPageLoad, 'xml');
}
this is how I'm calling Link actions,
// Set up action links
$("a.action-link[data-link-init='0']").each(function (e) {
$(this).attr('data-link-init', '1');
$(this).click(function (e) {
onActionLinkClick($(this).prop('id'));
if (e) { e.preventDefault ? e.preventDefault() : e.returnValue = false; };
});
});
我需要在排序后重新设置动作链接,
grid.attachEvent("onAfterSorting", function (index, type, direction) {
$("a.action-link[data-link-init='1']").each(function (e) {
$(this).click(function (e) {
onActionLinkClick($(this).prop('id'));
if (e) { e.preventDefault ? e.preventDefault() : e.returnValue = false; };
});
});
});
这对我有用。
grid.attachEvent("onAfterSorting", function (index, type, direction) {
$("a.action-link[data-link-init='1']").each(function (e) {
$(this).click(function (e) {
onActionLinkClick($(this).prop('id'));
if (e) { e.preventDefault ? e.preventDefault() : e.returnValue = false; };
});
});
});
我有一个 DhtmlXGrid,它具有 Link 按钮和排序功能。一切正常,但是,我最近添加了 splitAt() 以支持固定列,在此之后 link 按钮 onClick 在单击网格 headers 进行排序后未被调用。下面是我的代码,
function initGrid() {
setGridSize();
gridMenu.setIconsPath('..');
gridMenu.setImagePath('..);
gridMenu.renderAsContextMenu();
gridMenu.attachEvent('onClick', onButtonClick);
gridMenu.loadXML('..');
grid.setIconsPath('@urlDhtmlxImages');
grid.setImagesPath('@urlDhtmlxImages');
grid.enableContextMenu(gridMenu);
grid.attachEvent("onBeforeContextMenu", onShowMenu);
grid.setSkin('dhx_black');
grid.enableColumnAutoSize(false); // Double-click header will size to fit
// grid.attachEvent("onBeforeSorting", onBeforeSort);
grid.attachEvent("onEditCell", onEditCell); // Edit Cell
//grid.attachEvent("onCellMarked", onCellChanged);
var combobox1 = grid.getCombo(4);
combobox1.put("Yes", "Yes");
combobox1.put("No", "No");
var combobox2 = grid.getCombo(5);
combobox2.put("Yes", "Yes");
combobox2.put("No", "No");
//grid.enableSmartRendering(true);
//grid.attachEvent("onDhxCalendarCreated", createCalender);
grid.init();
grid.splitAt(1);
grid.load('...', FillGirdDataOnPageLoad, 'xml');
}
this is how I'm calling Link actions,
// Set up action links
$("a.action-link[data-link-init='0']").each(function (e) {
$(this).attr('data-link-init', '1');
$(this).click(function (e) {
onActionLinkClick($(this).prop('id'));
if (e) { e.preventDefault ? e.preventDefault() : e.returnValue = false; };
});
});
我需要在排序后重新设置动作链接,
grid.attachEvent("onAfterSorting", function (index, type, direction) {
$("a.action-link[data-link-init='1']").each(function (e) {
$(this).click(function (e) {
onActionLinkClick($(this).prop('id'));
if (e) { e.preventDefault ? e.preventDefault() : e.returnValue = false; };
});
});
});
这对我有用。
grid.attachEvent("onAfterSorting", function (index, type, direction) {
$("a.action-link[data-link-init='1']").each(function (e) {
$(this).click(function (e) {
onActionLinkClick($(this).prop('id'));
if (e) { e.preventDefault ? e.preventDefault() : e.returnValue = false; };
});
});
});