Bootstrap Table
Bootstrap Table
我正在尝试测试从cdn加载引导表的引导表。这是我的Jasmine测试的夹具文件
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title></title>
<script src="<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.10.1/bootstrap-table.js" type="text/javascript"></script>
" type="text/javascript"></script>
</head>
<body>
<table id="Table" class ="hidden">
<thead>
<tr>
<th data-field="foo">foo</th>
<th data-field="foo1">foo1</th>
</tr>
</thead>
</table>
<script type="text/javascript">
var foo = [
{"foo" : "foo",
"foo1 : 3 } ];
</script>
<script type="text/javascript" src="src/main/webapp/javascript/foodata.js"></script>
我正试着让Jasmine测试一下这张桌子。这是我的js文件:
/***使用foo数据和分页调用BootStrap表*/
$(function(){
var table= $('#Table').bootstrapTable({
data : foo,
pagination: true,
pageList: [10, 25, 50, 100]
});
table.removeClass('hidden');
});
当我尝试运行规范时,它显示XMLHTTP错误。如果我使用bootstrap tale js文件,它会完美加载。但当我使用CDN作为引导表时,它并没有。有什么方法可以在fixture中使用CDN吗?
您在代码上有一些错误,在包括引导表的脚本标记中,您还应该包含jquery以使其工作。此外,您在名为foo的变量中也出现了一些错误。
$(function(){
var table= $('#Table').bootstrapTable({
data : foo,
pagination: true,
pageList: [10, 25, 50, 100]
});
table.removeClass('hidden');
});
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.10.1/bootstrap-table.js" type="text/javascript"></script>
</head>
<body>
<table id="Table" class ="hidden">
<thead>
<tr>
<th data-field="foo">foo</th>
<th data-field="foo1">foo1</th>
</tr>
</thead>
</table>
<script type="text/javascript">
var foo = [ {"foo" : "foo","foo1" : 3 } ];
</script>
相关文章:
- 如何在Bootstrap Modal中为动态点击生成的变量设置jade属性
- 浮动页脚栏-使用Bootstrap隐藏
- Twitter Bootstrap typeahead:使用“this”获取上下文/调用元素
- 创建带有和不带有JavaScript的Bootstrap下拉菜单
- AngularJS/HTML/Bootstrap元素用于动态搜索结果
- Javascript+Bootstrap图像库未加载
- Bootstrap Dropdown selection是在*all*下拉菜单上设置选择
- Bootstrap 3 Datepicker v4:dp.show和dp.change事件在Datepicker内联时不
- Jquery - table.row(tr) is undefined
- Bootstrap-三列相等;t更改'a'要素
- 在bootstrap中显示隐藏特定的li
- 为什么引导程序下拉菜单只有在包含bootstrap-responsive.css时才起作用
- Twitter Bootstrap 2.1.0子菜单在Responsive上看起来很混乱
- Bootstrap折叠按钮不适用于android
- onRowClick for react-bootstrap-table
- Bootstrap Table
- React-bootstrap-table搜索嵌套字段
- bootstrap-table-filter-control扩展不能在bootstrap-table中工作
- Bootstrap -不能得到“table- striped_”
- 如何用bootstrap-table和x-editable显示加载时的数据错误