【发布时间】:2014-07-15 10:59:05
【问题描述】:
我需要在 asp.net mvc5 框架中为递归输出创建一个树视图。 这是我的模型课
public class ProcSearchModel
{
/// <summary>
///
/// </summary>
public string TableName { get; set; }
/// <summary>
///
/// </summary>
public string DirectoryPath { get; set; }
/// <summary>
///
/// </summary>
public List<string> ProceduresName { get; set; }
// public List<ProcSearchModel> =
}
将结果列表存储在 ProceduresName 列表中。 现在对于列表中的每个过程名称,其中都有另一个名称列表。我需要将其填充为树视图..
目前这是我的控制器功能:
public ActionResult SearchProcedure(ProcSearchModel procSearchModel)
{
List<string> lstString = new List<string>();
//if (procSearchModel != null)
//{
try
{
var txtFiles = Directory.EnumerateFiles(procSearchModel.DirectoryPath, "*.sql", SearchOption.AllDirectories);
// pattern to capture the Stored procedue name
// string cpattern = @"(CREATE PROCEDURE|ALTER PROCEDURE)\s*(?<proc_name>(\w|_|\[|\]|\.)*)(.|\n)*" + procSearchModel.TableName;
string cPattern = @"(CREATE PROCEDURE|ALTER PROCEDURE)\s*(?<proc_name>(\w|_|\[|\]|\.)*)";
string tPattern = procSearchModel.TableName;
foreach (string currentFile in txtFiles)
{
string content = System.IO.File.ReadAllText(currentFile);
if(Regex.IsMatch(content,tPattern,RegexOptions.IgnoreCase) && Regex.IsMatch(content,cPattern,RegexOptions.IgnoreCase))
{
Match match = Regex.Match(content, cPattern, RegexOptions.IgnoreCase);
lstString.Add(match.Groups["proc_name"].Value);
}
}
procSearchModel.ProceduresName = lstString;
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
//}
return View(procSearchModel);
}
现在请帮助我如何使用 jstree 插件通过 usnig 嵌套列表填充树视图
【问题讨论】:
标签: asp.net-mvc-5 jstree razorengine