使用细丝组tablesaw插件时未显示标签
Label not displayed while using filament group tablesaw plugin
我一直在尝试使用细丝组的tablesaw插件(仅限堆栈版本)来渲染一个响应表。视图基本上是使用主干和下划线模板进行渲染的。但是,在减少视图端口的同时,标签不会显示出来。
https://github.com/filamentgroup/tablesaw
我的背部骨骼视图如下。该模型是从spec.json文件中读取的。
App.views.AnalyticsView = Backbone.View.extend({
render: function () {
this.$el.html(this.template());
var $tableBody = this.$el.find('#table-body');
//Creating analytics table rows from spec.json
//Appending to table body in analytics page template
_.each(this.collection.models, function(model) {
var rowHtml = '<tr>';
_.each(model.attributes, function(value) {
rowHtml += '<td>' + value + '</td>';
});
rowHtml += '</tr>';
$tableBody.append(rowHtml);
});
return this;
}
});
我的下划线模板如下-
<div class="row-fluid">
<div class="span12">
<p><%_ analytics.intro %></p>
</div>
</div>
<div>
</div>
<table class="tablesaw tablesaw-stack" data-tablesaw-mode="stack">
<thead id="table-head">
<th><%_ analytics.parameter %></th>
<th><%_ analytics.title %></th>
<th><%_ analytics.apisource %></th>
<th><%_ analytics.description %></th>
</thead>
<tbody id="table-body"></tbody>
</table>
</div>
表头使用underi18n进行国际化。我是一个新手,所以请随时告诉我是否有更好的方法来呈现这个观点。我的目标是获得一个完全响应的表,其数据将从spec.json文件中设置。
提前谢谢。
所以问题已经解决了。我不得不编辑tablesaw插件中的几行,特别是触发事件的地方。
早些时候是-this.$table.trigger( events.create, [ this, colstart ] );
,它没有触发所需的事件。我把它改成了$( document ).trigger( events.create, [ this, colstart ] );
,这样它就可以工作了。
我直接使用this.$el.find("#analytics-table").table();
调用了该插件。此外,我还删除了与该插件相关的"增强表锯"事件。
感谢@ahmad的帮助
相关文章:
- 在高图表中,每x步只显示标签
- 如何隐藏和显示标签控件JavaScript
- 如何在angular js的ng应用程序中以普通的htm显示标签
- 使用细丝组tablesaw插件时未显示标签
- 用Javascript在具有相同类的按钮上显示标签
- Dijit 按钮显示图标,但不以编程方式显示标签
- 当圆形图像在圆轮中发生变化时,如何在顶部显示标签
- jqPlot - 无法使 x 轴正确显示标签
- 在堆叠条形图上显示标签
- 在酒窝气泡图中的每个气泡内显示标签
- Struts2 显示标签动态链接显示相同的行值
- HTML,显示标签的输入值
- JS sup() 在 html 中显示标签
- 如何在我的WinJS工具栏上显示标签
- d3图表宽度不会在x轴上显示标签
- 如何在鼠标悬停在条形图上时显示标签
- Select2.js-如何防止显示标签
- 我无法在JQChart中显示标签
- 使用 jQuery 验证并尝试在标签无效时突出显示标签
- 将鼠标悬停在圆上时显示标签