实现了ztree与datagrid互动

This commit is contained in:
yubaolee
2015-10-30 23:14:31 +08:00
parent 104866d83b
commit 1f574aca70
10 changed files with 99 additions and 52 deletions

View File

@@ -35,6 +35,14 @@ namespace OpenAuth.Mvc.Controllers
return JsonHelper.Instance.Serialize(_orgApp.LoadChildren(id));
}
public void DelOrg(string json)
{
var delObj = JsonHelper.Instance.Deserialize<Org[]>(json);
foreach (var obj in delObj)
{
_orgApp.DelOrg(obj.Id);
}
}
}
}

View File

@@ -36,54 +36,42 @@
$.getJSON("OrgManager/LoadOrg", function (json) {
var zTreeObj = $.fn.zTree.init($("#orgTree"), setting, json);
$('#test-datagrid-array').datagrid({
gridTitle: '机构列表显示',
showToolbar: true,
toolbarItem: 'all',
columns: [
{ name: 'Name', width: '150', label: '机构名称' },
{ name: 'CreateTime', width: '120', label: '登记日期' }
],
data: json,
hiddenFields: ['Id'],
editUrl: 'ajaxDone1.html',
delUrl: 'ajaxDone1.html',
editMode: 'dialog',
fullGrid: true,
showLinenumber: true,
showCheckboxcol: true,
paging: false,
filterMult: false,
showTfoot: true
});
zTreeObj.expandAll(true);
loadDataGrid(json);
});
});
function loadDataGrid(data) {
$('#test-datagrid-array').datagrid({
gridTitle: '机构列表显示',
showToolbar: true,
toolbarItem: 'all',
columns: [
{ name: 'Name', width: '150', label: '机构名称' },
{ name: 'CreateTime', width: '120', label: '登记日期' }
],
data: data,
hiddenFields: ['Id'],
editUrl: 'OrgManager/AddOrg',
delUrl: 'OrgManager/DelOrg',
editMode: 'dialog',
fullGrid: true,
showLinenumber: true,
showCheckboxcol: true,
paging: false,
filterMult: false,
showTfoot: true
});
}
function zTreeOnClick(event, treeId, treeNode) {
$.getJSON("OrgManager/LoadChildren", { id: treeNode.Id }, function (json) {
$('#test-datagrid-array').destroy();
$('#test-datagrid-array').datagrid({
gridTitle: '机构列表显示',
showToolbar: true,
toolbarItem: 'all',
columns: [
{ name: 'Name', width: '150', label: '机构名称' },
{ name: 'CreateTime', width: '120', label: '登记日期' }
],
data: json,
hiddenFields: ['Id'],
editUrl: 'ajaxDone1.html',
delUrl: 'ajaxDone1.html',
editMode: 'dialog',
fullGrid: true,
showLinenumber: true,
showCheckboxcol: true,
paging: false,
filterMult: false,
showTfoot: true
});
$('#ztree-detail').empty().append('<table id="test-datagrid-array" data-width="100%" data-height="100%" class="table table-bordered"></table>');
loadDataGrid(json);
});
}

View File

@@ -8,7 +8,7 @@
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<connectionStrings>
@@ -18,20 +18,20 @@
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<!--定义文件存放位置-->
<file value="log\\"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyyMMdd'.txt'"/>
<staticLogFileName value="false"/>
<param name="MaxSizeRollBackups" value="100"/>
<file value="log\\" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd'.txt'" />
<staticLogFileName value="false" />
<param name="MaxSizeRollBackups" value="100" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
<root>
<level value="INFO"/>
<level value="INFO" />
<!--文件形式记录日志-->
<appender-ref ref="RollingLogFileAppender"/>
<appender-ref ref="RollingLogFileAppender" />
</root>
</log4net>
@@ -78,6 +78,10 @@
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>