<rdoc:include file="head.htm" />

<form name="form" method="post" onkeypress="return event.keyCode != 13;">
 <input type="hidden" name="pretask" value="modelselector" class="form-filter"/>
    
<div class="portlet box default" id='table_wrapper_$table_id'>

<div class="portlet-body" >

<div class="listview lv" id="listview$table_id"
    data-singleselect="$singleselect" 
    data-url="$_base"
    data-col="6"
    data-dlg="$dlg"
    data-modname="$_modname"
    data-keyword="$_keyword"
    data-treeview="$treeview"
    data-defaultviewtype="$defaultviewtype"
    data-vmask="$vmask"
    data-nooptmenu="1"
	>

	<template name="toolbar">
	
	<div id="toolbar$table_id" class="form-inline searchbar">
<!--# foreach($sfdb as $key=>$v) { if (empty($v['searchinput'])) continue; #-->
    <div class="form-group">
            $v[searchinput]
    </div>
<!--# } #-->

<!--# foreach($sfdb as $key=>$v) { if (($v['searchable'] & 2) == 2) { #-->
    <div class="form-group">
            $v[input]
    </div>
<!--# }} #-->
    <input type="button" class="btn btn-primary filter-field btnSearch" id="query$table_id" value="搜索"/>
    
    <!--# foreach($requestparams as $key=>$v) { #-->
    <input type="hidden" name="$key" value="$v" class="form-filter"/>
    <!--# } #-->
</div> 

		
	</template>
</div>


</div>
</div>

</form>


<script type="text/javascript">
jQuery(document).ready(function() {
    if ($.fn.bupload) {        
        $('.bupload').bupload({});
    }
    if (!$.fn.listview)
        return false;
    	
    var lv = $("#listview$table_id");
	var lvObj = new Listview(lv);
    
    var lvContainer = $('#table_wrapper_$table_id');
    var btnAdd = $("#{$table_id}add", lvContainer);
    var btnEdit = $("#{$table_id}edit", lvContainer);
    var btnDetail = $("#{$table_id}detail", lvContainer);
    var btnDel = $("#{$table_id}del", lvContainer);
    var btnRefresh = $("#{$table_id}refresh", lvContainer);

     //按钮可用与否
    btnEdit.prop('disabled', true);
    btnDetail.prop('disabled', true);
    btnDel.prop('disabled', true);
   
	//onSelect
	lvObj.on('onSelect', function(rows){
	    var len = rows.length;
	    if (len == 0) {
            btnEdit.prop('disabled', true);
            btnDetail.prop('disabled', true);
            btnDel.prop('disabled', true);
        } else if (len == 1) {
            btnEdit.prop('disabled', false);
            btnDetail.prop('disabled', false);
            btnDel.prop('disabled', false);
        } else {
            btnEdit.prop('disabled', true);
            btnDetail.prop('disabled', true);  
            if ($disabledeleteall)                      
                btnDel.prop('disabled', true);
            else
                btnDel.prop('disabled', false);
        }
	});
	//optmenuItem, true:接管消息管理，不使用默认处理，false将使用默认处理
	lvObj.on('onOptmenuItem', function(action,rows) {
		return false;
	});
	
	lvContainer.on('click', '.tmilink', function(e) {
	    e.preventDefault(); 
	    var res = lvObj.tmilink($(this));
	    
    });
    
    //select2
     $('.select2me').select2({
        language: 'zh-CN',
        width: '200'
    });
});	
</script>


<rdoc:include file="foot.htm" />
