12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- {extend name="common/common2" /}
- {block name="main"}
- <div class="ibox">
- <div class="ibox-content">
- <div class="row">
- <div class="col-xs-3">
- <a href="javascript:;" url="{:url('article_add',['id'=>$id])}" data-title="新增{$m_name}" onclick="layer_open(this,1)" class="btn btn-sm btn-primary">新增</a>
- </div>
- <div class="col-xs-9" style="text-align: right;">
- <a href="{:url('index')}" class="btn btn-sm btn-primary">返回上一页</a>
- </div>
- </div>
- </div>
- <div class="ibox-content">
- <div class="jqGrid_wrapper">
- <table id="table" style="border-collapse: collapse"></table>
- <div id="pager"></div>
- </div>
- </div>
- </div>
- {/block}
- {block name="script"}
- <script>
- $(function () {
- $(window).bind("resize",function(){
- var width=$(".jqGrid_wrapper").width();
- $("#table").setGridWidth(width);
- });
- $.jgrid.defaults.styleUI="Bootstrap";
- $("#table").jqGrid({
- url:"{:url('article',['id'=>$id])}",
- datatype: "json",
- colModel:[
- {label:'ID',name:'id',index:'id', width:30,sortable: false},
- {label:'题干',name:'title',index:'title',width:80,editable: false,sortable: false},
- {label:'分值',name:'score',index:'score',width:60,sortable: true},
- {label:'类型',name:'type',index:'type',width:30,editable: false,sortable: false,formatter:function (a,b,c){
- if(a == 1){
- return '多选';
- }else {
- return '单选';
- }
- }},
- {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
- var info_url = "{:url('edit_question',[],'')}/id/"+c.id;
- var del_url = "{:url('del_question',[],'')}/id/"+c.id;
- var btn = '<a url="'+info_url+'" href="javascript:;" data-title="编辑" onclick="layer_open(this,1)"><span class="label label-primary" title="编辑">编辑</span></a> ';
- btn += '<a href="'+del_url+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
- return btn;
- }},
- ],
- rowNum:10,
- rowList:[10,20,30,50,100],
- pager: '#pager',
- sortname: 'id',
- viewrecords: true,
- autowidth:true,
- mtype: 'post',
- height: 'auto',
- emptyrecords: "暂无数据",
- sortorder: "asc",
- caption:"{$m_name}",
- loadComplete: function (xhr) {
- if(xhr.code==0){
- layer.msg(xhr.msg);
- return false;
- }
- },
- });
- });
- </script>
- {/block}
|