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

<table id="dgWXMenu" class="easyui-datagrid" style="width:100%; height:auto;"
	data-options="
            toolbar: '#tbWXMenu',
			border: false,
			singleSelect: true,
			rownumbers: true,
			striped: true,
			fit: true,
			fitColumns: true,
			idField: 'ID',
			method: 'POST',
            url: '/MobileApp/LoadMenus/',
			queryParams: { type:1}
		">
	<thead>
		<tr>
			<th data-options="field:'Name',width:100,resizable:false">
				<%: Html.Language("MenuName")%>
			</th>
			<th data-options="field:'Sort',sortable:true,align:'center',resizable:false">
				<%: Html.Language("Sort")%>
			</th>
			<th data-options="
				field: 'ActiveIndicator',
				align: 'center',
				resizable:false,
				formatter: appApplyWXFormatter
			">
				<%: Html.Language("Display")%>
			</th>
		</tr>
	</thead>
</table>
<div id="tbWXMenu">
	<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-reload',plain:true" onclick="$('#dgWXMenu').datagrid('reload')"><%: Html.Language("Refresh")%></a>
</div>
<script type="text/javascript">
    function appApplyWXFormatter(val, row) {
        if (val) {
            return '<input type="checkbox" checked="checked" onchange="appApplyWXOnChange(this,\'' + row.ID + '\',\'' + row.Name + '\')" />';
        } else {
            return '<input type="checkbox" onchange="appApplyWXOnChange(this,\'' + row.ID + '\',\'' + row.Name + '\')" />';
        }
    }
    function appApplyWXOnChange(sender, id, name) {
        var params = { id: id, activeIndicator: $(sender).is(":checked") };
        $.tools.post(params, '/MobileApp/SaveWXMenu/');
    }
</script>