这是 this question 的轻微延续.
我正在使用 ng-grids 新版本 ui-grid并且我对 editableCellTemplate 有疑问。我 我正在使用模板显示使用 ng-options 进行编辑的动态下拉列表。这工作正常,但单元格似乎卡在了编辑模式。我之前在与旧版本的 ng-grid 相关的堆栈溢出上看到过这个问题。 (比如 this 帖子)
这些解决方案通常最终会指出他们忘记在选择中使用 ng-input="COL_FIELD"
。
我已经尝试过这样的方法,但它似乎不适用于 ui-grid。也许是因为我正在使用 ng-options 而其他示例没有?这是一个 plunker网格中的下拉列表。请注意,如果您失去焦点,单元格仍将处于编辑模式。
有没有人遇到过 ui-grid 的这个问题并解决了它?如果是这样,任何帮助将不胜感激。
最佳答案
将 ng-cell-input 替换为 ui-grid-edit-dropdown
顺便说一句,这是 default template
<div>
<form name="inputForm">
<select ng-class="'colt' + col.uid" ui-grid-edit-dropdown ng-model="MODEL_COL_FIELD" ng-options="field[editDropdownIdLabel] as field[editDropdownValueLabel] CUSTOM_FILTERS for field in editDropdownOptionsArray"></select>
</form>
</div>
如果没有原因,也许不需要自定义模板,检查this tutorial .
关于javascript - ui-grid 中的 EditableCellTemplate 卡在编辑模式 [ng-grid 3.X],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26490269/