Skip to content

Commit fb6f464

Browse files
committed
Merge pull request #62 from dkamburov/master
Use cellById method to get the proper cell for updating
2 parents 6f0aaac + 6fed1c3 commit fb6f464

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

src/igniteui-angular.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
var i, j, existingDomRow, existingRow,
175175
grid = element.data("igGrid"), pkKey = grid.options.primaryKey,
176176
gridUpdating = element.data("igGridUpdating"), column,
177-
record, td, colIndex, newFormattedVal, dsRecord,
177+
record, td, newFormattedVal, dsRecord,
178178
ds = scope.$eval(attrs.source), diff = [];
179179
/* check for a change of the data source. In this case rebind the grid */
180180
if (ds !== grid.options.dataSource) {
@@ -238,8 +238,7 @@
238238
// update the DOM of the grid
239239
column = grid.columnByKey(diff[ i ].txlog[ j ].key);
240240
record = ds[ diff[ i ].index ];
241-
colIndex = grid._getCellIndexByColumnKey(diff[ i ].txlog[ j ].key);
242-
td = element.find("tr[data-id='" + record[ pkKey ] + "']").children().get(colIndex);
241+
td = grid.cellById(record[ pkKey ], diff[ i ].txlog[ j ].key);
243242
if (column.template || grid.options.rowTemplate) {
244243
newFormattedVal = grid
245244
._renderTemplatedCell(diff[ i ].txlog[ j ].newVal, column)

test/e2e/scenarios.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,42 @@ describe("my app", function() {
527527
expect(util.getResult('$("#grid1 tbody tr:eq(3) td")[1].innerHTML')).toBe("Oil");
528528
expect(util.getResult(scopeNorthwind)).toBe(util.getResult(gridData));
529529
});
530+
531+
it("should update the correct cell when there is column fixing", function () {
532+
//new grid with group by
533+
util.resetNorthwindScope();
534+
util.executeScript('$("#grid1").igGrid("destroy");');
535+
util.executeScript('$("#grid1").remove();');
536+
util.executeScript('angular.element("body").scope().addGrid(\''
537+
+ '<ig-grid id="grid1" data-source="northwind" height="400px" primary-key="ProductID" auto-commit="true" width="700px" auto-generate-columns="false">'
538+
+ '<columns>'
539+
+ '<column key="ProductID" header-text="Product ID" width="200px" data-type="number"></column>'
540+
+ '<column key="ProductName" header-text="Name" width="300px" data-type="string"></column>'
541+
+ '<column key="QuantityPerUnit" header-text="Quantity per unit" width="200px" data-type="string"></column>'
542+
+ '<column key="UnitsOnOrder" header-text="Units on order" width="200px" data-type="number"></column>'
543+
+ '</columns>'
544+
+ '<features>'
545+
+ '<feature name="Updating">'
546+
+ '<column-settings>'
547+
+ '<column-setting column-key="ProductID" read-only="true">'
548+
+ '</column-settings>'
549+
+ '</column-settings>'
550+
+ '</feature>'
551+
+ '<feature name="ColumnFixing">'
552+
+ '<column-settings>'
553+
+ '<column-setting column-key="ProductName" is-fixed="true">'
554+
+ '</column-setting>'
555+
+ '</column-settings>'
556+
+ '</feature>'
557+
+ '</features>'
558+
+ '</ig-grid>'
559+
+ '\');'
560+
);
561+
util.executeScript('angular.element("#grid1").scope().northwind[0].ProductName = "Tea";');
562+
util.executeScript('angular.element("#grid1").scope().$apply();');
563+
expect(util.getResult('$("#grid1_fixed tbody tr:eq(0) td")[0].innerHTML')).toBe("Tea");
564+
expect(util.getResult('$("#grid1 tbody tr:eq(0) td")[0].innerHTML')).toBe("1");
565+
});
530566
});
531567

532568
describe("Tree", function() {

0 commit comments

Comments
 (0)