我使用的是fooTable,<td>元素的内部内容存在问题。他们都被移走了。在以前的版本中,情况并非如此,但v3将其删除。例如,如果我添加一个按钮<td><button class="online">Turn on</button></td>,它将被删除,以及表单元格的类。
如何才能防止这种情况发生?
发布于 2015-10-15 15:06:31
对于任何想要防止这种情况的人来说,这种改变可以在footable.js中进行。改变这一点:
$create: function(){
if (this.created) return;
(this.$el = F.is.jq(this.$el) ? this.$el : $('<td/>'))
.data('value', this.value)
.contents().detach().end()
.append(this.format(this.value));
this._setClasses(this.$el);
this._setStyle(this.$el);
this.$detail = $('<tr/>').addClass(this.row.classes.join(' ')).data('__FooTableCell__', this)
.append($('<th/>', { text: this.column.title }))
.append($('<td/>'));
this.created = true;
},至:
$create: function(){
if (this.created) return;
(this.$el = F.is.jq(this.$el) ? this.$el : $('<td/>'))
.data('value', this.value)
.contents();
this._setClasses(this.$el);
this._setStyle(this.$el);
this.$detail = $('<tr/>').addClass(this.row.classes.join(' ')).data('__FooTableCell__', this)
.append($('<th/>', { text: this.column.title }))
.append($('<td/>'));
this.created = true;
},好吧,这也许不是最好的处理方法,但它达到了我的目的。这会留下未格式化的内容,并保持链接、按钮、类设置.
发布于 2016-03-02 06:03:48
我们设置头部数据参数如何?
“数据类型”=“html”
发布于 2015-10-17 01:47:45
添加到@user4675957的卓越贡献:当您使用内部HTML时,详细信息(折叠表)版本将显示为文本。这是因为它是以这样的方式加载的。
要防止这种情况,请在$create函数中修改这一行:
.append($('<th/>', { text: this.column.title }))至
.append($('<th/>').append(this.column.title))https://stackoverflow.com/questions/33138368
复制相似问题