Hi
I am trying to hide / show the add / delete row buttons on specific rows of the igTreeGrid.
I followed your code suggestion but it does not do anything on the screen.
Thanks for your help.
here is my code:
<table id="treegrid1" dir="rtl"></table>
$("#treegrid1 > tbody > tr").hover( function(evt) { alert(1); var rowID = $(this).attr("data-id"); // Get the row id. if (hasChildren(rowID)){ $("span.ui-iggrid-deletebutton").hide(); } else { $("span.ui-iggrid-deletebutton").show(); } }, function(evt) { alert(2); $("span.ui-iggrid-deletebutton").show(); });
var TheGrid ; var ParentRow;
$(function () { $('#divErrMsg').hide(); //append the elements to the page TheGrid = $("#treegrid1");
TheGrid.igTreeGrid({ width: "100%", //dataSource: gridData, //bound to flat data source, autoGenerateColumns: false, primaryKey: "bgt_rowid", foreignKey: "bgt_prowid", initialExpandDepth: 0, updateUrl: "Services/BudgetService.asmx/Update", autoCommit : true, columns: [ { headerText: "שם", key: "rowName" , width: "300px" , dataType: "string" }, { headerText: "rowID", key: "bgt_rowid", width: "100px", dataType: "number" , hidden: true},//must column. without it the grid is not working properly. { headerText: "ParentID", key: "bgt_prowid", width: "100px", dataType: "number", hidden: true },//must column. without it the grid is not working properly. //dynamically add columns <% foreach (Builder.Tarbut.DAL.BudgetColumn col in GridCols) { Response.Write(string.Format("{{ headerText: \"{0}\", key: \"{1}\", dataType: \"number\" }},", col.ColTitle, col.ID));} %> ], features: [ { name: "Selection", multipleSelection: true, mode: "cell", activation: true }, { name: "Sorting", applySortedColumnCss: false, //mode: "multi" }, { name: "Filtering", //filterButtonLocation : "right", labels: { advancedButtonLabel: "Advanced", after: "לפני", before: "אחרי", clear: "נקה סינון", contains: "מכיל", doesNotContain: "אינו מכיל", doesNotEqual: "שונה מ", empty: "ריק", endsWith: "מסתיים ב", equals: "שווה ל", false: "false", falseLabel: "false", filterDialogCaptionLabel: "Advanced Filtering", greaterThan: "גדול מ", greaterThanOrEqualTo: "גדול או שווה ל", lessThan: "קטן מ", lessThanOrEqualTo: "קטן או שווה ל", startsWith: "מתחיל ב"
}, nullTexts: { after: "לפני...", before: "אחרי...", clear: "נקה סינון", contains: "מכיל...", doesNotContain: "אינו מכיל...", doesNotEqual: "שונה מ...", empty: "ריק", endsWith: "מסתיים ב...", equals: "שווה ל...", false: "false", falseLabel: "false", filterDialogCaptionLabel: "Advanced Filtering", greaterThan: "גדול מ...", greaterThanOrEqualTo: "גדול או שווה ל...", lessThan: "קטן מ...", lessThanOrEqualTo: "קטן או שווה ל...", startsWith: "מתחיל ב...", } }, /*{ name: "Paging", pageSizeDropDownLabel: "הצג", pageSizeDropDownTooltip: "בחר מספר רשומות לתצוגה", pageSizeDropDownTrailingLabel: "רשומות", currentPageDropDownLeadingLabel: "Current XX Page XX", currentPageDropDownTrailingLabel: "X Pages XXX", firstPageLabelText: "ראשון", firstPageTooltip: "עבור לדף הראשון", lastPageLabelText: "אחרון", lastPageTooltip: "עבור לדף האחרון", nextPageLabelText: "הבא", nextPageTooltip: "עבור לדף הבא", prevPageLabelText: "הקודם", prevPageTooltip: "עבור לדף הקודם", pagerRecordsLabelTemplate: "${startRecord} עד ${endRecord} מתוך ${recordCount}", pageSize: 50 },*/ /*{ name: "ColumnMoving", mode: "deferred", columnSettings: [ { columnKey: "bld_rowname", allowMoving: false }, { columnKey: "bld_rowid", allowMoving: false } ] }, { name: "Resizing", allowDoubleClickToResize: true },*/ { name: "Updating", enableAddRow: false, enableAddChild: true, addRowLabel: "הוסף שורה", cancelLabel: " בטל", doneLabel: " המשך", editMode: "cell", enableDeleteRow: true, excelNavigationMode: true, horizontalMoveOnEnter: true, validation: true, startEditTriggers: "click,f2,enter", columnSettings: [ { columnKey: "rowName", editorOptions: { type: "text", required: true //disabled: true } }, ], editCellEnded: function(evt, ui){ if (ui.update && !isCalculatingSummaries && TheGrid.igTreeGrid('columnByKey', ui.columnKey).dataType === 'number'){//calculate summary for numbers when cell changes var parentId = TheGrid.igTreeGrid("getCellValue", ui.rowID, "bgt_prowid"); calculateSummaries(parentId, ui.columnKey); } }, editCellStarting: function(evt, ui){//enable or disable editing //verify permissions to edit row and disable editing if no permission if (!isRowEditable(ui)){ showErrMsg('אינך רשאי לערוך שורה זו'); return false; }
//check if row has children and disable editing of numerical values if yes (parent rows cannot be edited, they are calculated) if (isSummaryCell(ui)){ showErrMsg('לא ניתן לערוך שורת סיכום'); return false; }
return true; }, rowDeleted: function(evt, ui){//recalculate summaries. $.each(TheGrid.igTreeGrid('option', 'columns'), function(i, col){//loop on all columns if(col.hidden == false && col.dataType === "number"){ //need to recalculate summary. (ignore hidden columns, they are key columns) calculateSummaries(ParentRow , col.key); } }); //TheGrid.igTreeGrid("getCellValue", 3, "ShipDate"); }, rowDeleting: function(evt, ui){ ParentRow = TheGrid.igTreeGrid("getCellValue", ui.rowID, "bgt_prowid"); } } ] });
Hello Hagar,
This post seems to be a duplicate of the following one:
http://ko.infragistics.com/community/forums/p/108247/509977.aspx#509977
Please refer to the answer in the other forum post.
Best Regards,
Maya Kirova
Infragistics, Inc.
http://ko.infragistics.com/support