Skip to content

Commit 79fbcd7

Browse files
committed
Remove substring when updating cells, add test for it, closes #69
1 parent ec1eedc commit 79fbcd7

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

src/igniteui-angular.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,7 @@
327327
td = grid.cellById(record[ pkKey ], diff[ i ].txlog[ j ].key);
328328
if (column.template || grid.options.rowTemplate) {
329329
newFormattedVal = grid
330-
._renderTemplatedCell(diff[ i ].txlog[ j ].newVal, column)
331-
.substring(1);
330+
._renderTemplatedCell(diff[ i ].txlog[ j ].newVal, column);
332331
} else {
333332
newFormattedVal = grid
334333
._renderCell(diff[ i ].txlog[ j ].newVal, column, record);

test/e2e/scenarios.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,39 @@ describe("my app", function() {
573573
expect(util.getResult('$("#grid1 tbody tr:eq(1) td")[2].innerHTML'))
574574
.toBe(util.getResult('angular.element("#grid1").scope().northwind[1].UnitsOnOrder.toString()'));
575575
});
576+
577+
it("should apply column template correctly", function () {
578+
util.resetNorthwindScope();
579+
util.executeScript('$("#grid1").igGrid("destroy");');
580+
util.executeScript('$("#grid1").remove();');
581+
util.executeScript('angular.element("body").scope().addGrid(\''
582+
+ '<ig-grid id="grid1" data-source="northwind" height="400px" primary-key="ProductID" auto-commit="true" width="700px" auto-generate-columns="false">'
583+
+ '<columns>'
584+
+ '<column key="ProductID" header-text="Product ID" width="200px" data-type="number"></column>'
585+
+ '<column key="ProductName" header-text="Name" width="300px" data-type="string"></column>'
586+
+ '<column key="QuantityPerUnit" header-text="Quantity per unit" width="200px" data-type="string"></column>'
587+
+ '<column key="UnitsOnOrder" header-text="Units on order" width="200px" data-type="number" template="<span>${UnitsOnOrder}</span>"></column>'
588+
+ '</columns>'
589+
+ '<features>'
590+
+ '<feature name="Updating">'
591+
+ '<column-settings>'
592+
+ '<column-setting column-key="ProductID" read-only="true">'
593+
+ '</column-settings>'
594+
+ '</column-settings>'
595+
+ '</feature>'
596+
+ '</features>'
597+
+ '</ig-grid>'
598+
+ '\');'
599+
);
600+
//the template should be initialized correctly
601+
expect(util.getResult('$("#grid1 tbody tr:eq(1) td")[3].innerHTML'))
602+
.toBe('<span>40</span>');
603+
util.executeScript('angular.element("#grid1").scope().northwind[1].UnitsOnOrder = 200;');
604+
util.executeScript('angular.element("#grid1").scope().$apply();');
605+
//the template should be applied correctly after changes in scope`
606+
expect(util.getResult('$("#grid1 tbody tr:eq(1) td")[3].innerHTML'))
607+
.toBe('<span>200</span>');
608+
});
576609
});
577610

578611
describe("Tree", function() {

0 commit comments

Comments
 (0)