如何使用angular2 +在Datatable中添加空数据行? [英] How to add empty data row in Datatable using angular2+?
问题描述
我想添加空数据行。我的要求就像列是动态的。我尝试使用dtInstance添加行。
I want to add empty data row. My requirement is like columns are dynamic. I have tried using dtInstance to add the row. it's throwing some error.
这是链接
https://stackblitz.com / edit /如何替换所有列动态在数据表中gvfose?file = app / app.component.ts
请让我知道是否需要更多详细信息。
Please let me know if more details required.
推荐答案
有一个简单的演示针对您的要求,将另一个按钮保存要访问数据的空列。
There is a simple demo for your requirement that puts the other button to save the empty column you want to access the data.
为了易于使用,添加数据
按钮将在空白行中显示输入
,您想要设置CSS的样式,并且不要通过 Encapsulation
忘记CSS范围。
For easy to use, add DATA
button that would be shown the blank row with input
, the style you desire to set up the CSS and don't forgot the CSS scope for your by Encapsulation
.
如果操作字段是多余的,请将其清除并在输入符合逻辑条件的情况下将事件放置三列。
If the operation field is superfluous, rid it off and place the event for three columns after entering with your logical condition.
添加数据
可以用下面的代码替换,设置 life钩子
代替在构造函数中插入方法。
The add DATA
could be replaced with the below code, setup the life hook
instead for insert the method in the constructor.
ngAfterViewInit (){
this.addData();
}
这篇关于如何使用angular2 +在Datatable中添加空数据行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!