<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>

<table id="dgScene" class="easyui-datagrid" style="width: 100%; height: auto;" data-options="
		toolbar: '#tbRelationScene',
		border: false,
		singleSelect: true,
		pagination: true,
		pageSize: 50,
		rownumbers: true,
		sortName: 'Name',
		sortOrder: 'asc',
		fit: true,
		fitColumns: true,
		striped: true,
		idField: 'ID',
		url: '/RoomTypeScene/LoadAllByPage/',
		queryParams: { roomTypeID: <%: Model %>},
		method: 'POST',
		onDblClickRow: function(index, row) { editRoomTypeScene(row); }
	">
    <thead>
        <tr>
            <th data-options="field:'RoomTypeName',sortable:true,resizable:false">
                <%: Html.Language("RoomType")%>
            </th>
            <th data-options="field:'Type',sortable:true,resizable:false">
                <%: Html.Language("Type")%>
            </th>
            <th data-options="field:'Name',sortable:true,resizable:false">
                <%: Html.Language("ChineseName")%>
            </th>
            <th data-options="field:'AliasName',sortable:true,resizable:false">
                <%: Html.Language("AliasName")%>
            </th>
            <th data-options="field:'EnglishName',sortable:true,resizable:false">
                <%: Html.Language("EnglishName")%>
            </th>
            <th data-options="field:'TWName',resizable:false">
                <%: Html.Language("TWName")%>
            </th>
            <th data-options="field:'GroupAddress',sortable:true,resizable:false">
                <%: Html.Language("Command")%>
            </th>
            <th data-options="field:'TakeInverse',align:'center',resizable:false,formatter:takeInverseCheck">
                <%: Html.Language("TakeInverse")%>
            </th>
            <th data-options="field:'Sort',align:'center',sortable:true,resizable:false">
                <%: Html.Language("Sort")%>
            </th>
        </tr>
    </thead>
</table>
<div id="tbRelationScene">
    <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="$('#dgScene').datagrid('reload');"><%: Html.Language("Refresh")%></a> 
    <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="addRoomTypeScene(<%: Model %>)"><%: Html.Language("New")%></a> 
    <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true" onclick="editRoomTypeScene()"><%: Html.Language("Edit")%></a> 
    <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="delRoomTypeScene()"><%: Html.Language("Delete")%></a>
</div>
<script type="text/javascript">
    //低电是否显示
    function takeInverseCheck(val, row) {
        var url = '/RoomTypeScene/SaveTakeInverseChange/';
        if (val) {
            return '<input type="checkbox" checked="checked" onchange="updateDisplay(this,\'' + row.ID + '\',\'' + url + '\')" />';
        } else {
            return '<input type="checkbox" onchange="updateDisplay(this,\'' + row.ID + '\',\'' + url + '\')" />';
        }
    }
    //更新显示
    function updateDisplay(sender, id, url) {
        var params = { id: id, activeIndicator: $(sender).is(":checked") };
        $.tools.post(params, url);
    }
</script>
