
jQuery treetable第二次加载的数据为什么展不开啊?
内容我都是通过ajax异步加载的,但是只能展开第一次加载的数据,选择不同的月份,再次加载就展不开了,求各位大神解答啊!!!!jsp加载内容如图2所示...
内容我都是通过ajax异步加载的,但是只能展开第一次加载的数据,选择不同的月份,再次加载就展不开了,求各位大神解答啊!!!!jsp加载内容如图2所示
展开
1个回答
2017-12-19 · 百度知道合伙人官方认证企业
1【专注:Python+人工智能|Java大数据|HTML5培训】 2【免费提供名师直播课堂、公开课及视频教程】 3【地址:北京市昌平区三旗百汇物美大卖场2层,微信公众号:yuzhitc】
向TA提问
关注

展开全部
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Service88.Core.Products.ProductCategory>>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script src="../../Scripts/treeTable/doc/javascripts/jquery.js" type="text/javascript"></script>
<script src="../../Scripts/treeTable/doc/javascripts/jquery.ui.js" type="text/javascript"></script>
<script src="../../Scripts/treeTable/src/javascripts/jquery.treeTable.js" type="text/javascript"></script>
<link href="../../Scripts/treeTable/src/stylesheets/jquery.treeTable.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function() {
$("#dnd-example").treeTable();
// Drag & Drop Example Code
$("#dnd-example .file, #dnd-example .folder").draggable({
helper: "clone",
opacity: .75,
refreshPositions: true, // Performance?
revert: "invalid",
revertDuration: 300,
scroll: true
});
$("#dnd-example .folder").each(function() {
$($(this).parents("tr")[0]).droppable({
accept: ".file, .folder",
drop: function(e, ui) {
$($(ui.draggable).parents("tr")[0]).appendBranchTo(this);
},
hoverClass: "accept",
over: function(e, ui) {
if (this.id != ui.draggable.parents("tr.parent")[0].id && !$(this).is(".expanded")) {
$(this).expand();
}
}
});
});
// Make visible that a row is clicked
$("table#dnd-example tbody tr").mousedown(function() {
$("tr.selected").removeClass("selected"); // Deselect currently selected rows
$(this).addClass("selected");
});
// Make sure row is selected when span is clicked
$("table#dnd-example tbody tr span").mousedown(function() {
$($(this).parents("tr")[0]).trigger("mousedown");
});
});
</script>
<%Html.BeginForm("SearchProduct","ProductCategory",FormMethod.Post); %>
<table cellpadding="3" cellspacing="1" border="0" width="100%" align="center" class="searchTable">
<tr>
<td colspan="2" height="25" class="td_title">
搜索
</td>
</tr>
<tr>
<td width="20%" height="23">
搜索条件:
</td>
<td class="forumRow">
分类代码:<%=Html.TextBox("categoryCode")%>
分类名:<%=Html.TextBox ("categoryName") %>
<input type="hidden" value="0" name="pageIndex" />
<input type="submit" name="search" value="搜索" id="submit" class="button searchBtn" />
</td>
</tr>
</table>
<%Html.EndForm(); %>
<br />
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="listHeader">
<tr>
<td class="td_title" height="25">
产品类型列表
</td>
<td style="text-align:right" class="td_title">
<%= Html.ActionLink("添加一级分类", "Add",null,new {@class="addLink"}) %>
</td>
</tr>
</table>
<table id="dnd-example" cellspacing="1" cellpadding="3" rules="all" border="0" class="listTable" style="border-width:0px;width:100%; padding-left :2px;">
<thead>
<tr>
<th>商品分类代码</th>
<th>商品分类名</th>
<th>序号</th>
<th>操作</th>
</tr>
</thead>
<%
foreach (var item in Model)
{
var node = "node--";
var parent = "parent ";
var bar = "-";
var childOf = "child-of-";
var parentIdName = node + item.Code;
var parentClassName = parent;
var childIdName = "";
var childClassName = "";
// var noParentIdName = childIdName;
var noChildClassName = "";
string[] productCategoryParent=null;
if(item.Parent ==null)
{
productCategoryParent=item.Code.Split (',');
}
foreach (var pcp in productCategoryParent)
{
}
//一级分类:无父类
if (item.Parent == null)
{ %>
<tbody>
<tr id="<%=parentIdName %>" class="<%=parentClassName %>">
<td>
<span class="folder"> <%= Html.Encode(item.Code)%></span>
</td>
<td>
<%= Html.Encode(item.Name)%>
</td>
<td>
<%= Html.Encode(item.Sequence)%>
</td>
<td>
<%= Html.ActionLink("编辑", "Edit", new { CategoryId = item.ID }, new { @class = "editLink" })%> |
<%= Html.ActionLink("删除", "Delete", new { CategoryId = item.ID }, new { @class = "delLink" })%> |
<%= Html.ActionLink("添加子类", "AddChild", new { CategoryId = item.ID }, new { @class = "addLink" })%>
</td>
</tr>
</tbody>
<%}
//有父级分类且有子类
if (item.Parent != null && item.Children != null)
{
childIdName = node + item.Parent .Code +bar+ item.Code;
childClassName = parent + childOf + node + item.Parent .Code;
%>
<tbody>
<tr id="<%=childIdName %>" class="<%=childClassName%>">
<td>
<span class="folder"><%= Html.Encode(item.Code)%></span>
</td>
<td>
<%= Html.Encode(item.Name )%>
</td>
<td>
<%= Html.Encode(item.Sequence)%>
</td>
<td>
<%= Html.ActionLink("编辑", "Edit", new { CategoryId = item.ID }, new { @class = "editLink" })%> |
<%= Html.ActionLink("删除", "Delete", new { CategoryId = item.ID }, new { @class = "delLink" })%> |
<%= Html.ActionLink("添加子类", "AddChild", new { CategoryId = item.ID }, new { @class = "addLink" })%>
</td>
</tr>
</tbody>
<%}
//有父级分类且无子类
if(item.Parent!=null && item.Children ==null)
{
childIdName = node + item.Parent.Code +bar+ item.Code;
noChildClassName = childOf + node + item.Parent .Code;
%>
<tbody>
<tr id="<%=childIdName%>" class="<%=noChildClassName%>">
<td>
<span class="file"><%= Html.Encode(item.Code)%></span>
</td>
<td>
<%= Html.Encode(item.Name )%>
</td>
<td>
<%= Html.Encode(item.Sequence)%>
</td>
<td>
<%= Html.ActionLink("编辑", "Edit", new { CategoryId = item.ID }, new { @class = "editLink" })%> |
<%= Html.ActionLink("删除", "Delete", new { CategoryId = item.ID }, new { @class = "delLink" })%> |
<%= Html.ActionLink("添加子类", "AddChild", new { CategoryId = item.ID }, new { @class = "addLink" })%>
</td>
</tr>
</tbody>
<%}
} %>
</table>
</asp:Content>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询