DhtmlXGrid's LinkButtons are not working after SplitAt()

162 views Asked by At

I've a DhtmlXGrid which has Link buttons and sort functionality. It was working all fine, however, I've added the splitAt() recently to support fixed columns, after this link buttons onClick is not getting called after clicking on grid headers for sorting. below is my code,

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; };
});
});
2

There are 2 answers

0
Diya On BEST ANSWER
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; };
});
});
});
0
Ashwath On

I need to setup the actionLinks again afterSorting,

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; };
});
});
});

This is working for me now.