admin管理员组文章数量:1426072
Hi Everyone,
I am trying to implementing inline row edit using ng table
When I click on edit icon then I changed the values then I click on save icon I am gettin below error
TypeError: Cannot read property 'untrack' of undefined
Please find plunker Inline row edit using ng table for details coding
<table
class="alignment table table-striped table table-bordered table-hover table-condensed editable-table demoTable"
ng-table="tableParams" ng-show="showTable" ng-form="tableForm" demo-tracked-table="tableTracker">
<colgroup>
<col width="45%" />
<col width="45%" />
<col width="10%" />
</colgroup>
<tr ng-repeat="row in $data" ng-form="rowForm" demo-tracked-table-row="row">
<td data-title="'INR Rate'" ng-switch="row.isEditing" ng-class="inrRate.$dirty ? 'bg-warning' : ''" ng-form="inrRate" demo-tracked-table-cell>
<span ng-switch-default class="editable-text">{{row.INRRate}}</span>
<div class="controls" ng-class="inrRate.$invalid && inrRate.$dirty ? 'has-error' : ''" ng-switch-when="true">
<input type="number" name="inrRate" ng-model="row.INRRate" class="editable-input form-control input-sm" required />
</div>
</td>
Hi Everyone,
I am trying to implementing inline row edit using ng table
When I click on edit icon then I changed the values then I click on save icon I am gettin below error
TypeError: Cannot read property 'untrack' of undefined
Please find plunker Inline row edit using ng table for details coding
<table
class="alignment table table-striped table table-bordered table-hover table-condensed editable-table demoTable"
ng-table="tableParams" ng-show="showTable" ng-form="tableForm" demo-tracked-table="tableTracker">
<colgroup>
<col width="45%" />
<col width="45%" />
<col width="10%" />
</colgroup>
<tr ng-repeat="row in $data" ng-form="rowForm" demo-tracked-table-row="row">
<td data-title="'INR Rate'" ng-switch="row.isEditing" ng-class="inrRate.$dirty ? 'bg-warning' : ''" ng-form="inrRate" demo-tracked-table-cell>
<span ng-switch-default class="editable-text">{{row.INRRate}}</span>
<div class="controls" ng-class="inrRate.$invalid && inrRate.$dirty ? 'has-error' : ''" ng-switch-when="true">
<input type="number" name="inrRate" ng-model="row.INRRate" class="editable-input form-control input-sm" required />
</div>
</td>
Share
Improve this question
edited Oct 30, 2015 at 17:48
Ravindhar Konka
asked Oct 30, 2015 at 14:18
Ravindhar KonkaRavindhar Konka
1532 silver badges13 bronze badges
1
- Are you able to solve this issue? is so please post your answer Thanks – Muddu Patil Commented Dec 9, 2015 at 6:46
2 Answers
Reset to default 4I met the same problem but no luck after investigation on sample code. I modified the code and it works fine until now.
- Do not use "ngTableSimpleList". It is just a data set for table which defined in sample code by author.
- It seems tableTracker.untrack(row) can be removed safely.
However,
var originalRow = resetRow(row, rowForm);
would get a nil value which cause the value doesn't recover correctly, since_.findWhere
is an asynchronous method. So I replace it withfor
loop.function resetRow(row, rowForm) { row.isEditing = false; rowForm.$setPristine(); //self.tableTracker.untrack(row); for ( let i in originalData){ if(originalData[i].id === row.id){ return originalData[i] } } //return _.findWhere(originalData, function(r) { // return r.id === row.id; //}); }
You were injecting NgTableParams
instead of ngTableParams
- see working: fixed example
demoController.$inject = ["ngTableParams", "ngTableSimpleList", "$scope"];
本文标签: javascriptInline row editing using ng tableStack Overflow
版权声明:本文标题:javascript - Inline row editing using ng table - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745414888a2657638.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论