高分求助UltraWebGrid有关合并行的问题 谢谢各位指点

zjybushiren88888 2010-12-07 05:45:26
<DisplayLayout RowHeightDefault="30px" Version="4.00"
SelectTypeRowDefault="Extended" BorderCollapseDefault="Separate" StationaryMargins="Header"
TableLayout="Fixed" ViewType="Hierarchical" RowSelectorsDefault="No"
ColWidthDefault="120" RowSizingDefault="Free" >

UltraWebGrid设置了viewType后

如何合并行

EG:
a b c d
1 2 3 4
1 2 3 4
1 2 3 4

我想实现的效果如下:
a b c d
2 3 4
1 2 3 4
2 3 4
...全文
67 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
wosizy 2010-12-08
  • 打赏
  • 举报
回复
zjybushiren88888 2010-12-08
  • 打赏
  • 举报
回复
是在设置了viewtype DataTable关联后在合并行
zjybushiren88888 2010-12-08
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 wosizy 的回复:]
C# code

01.#region 合并单元格(自动合并转为人工合并)
02.private void SetMergeCells(Infragistics.WebUI.UltraWebGrid.UltraWebGrid uwgReport,string key)
03.{
04. for (int i = 0; i < uwgReport.Columns.C……
[/Quote]
这个代码我网上也搜的到 能否给个合并行的demo
wosizy 2010-12-08
  • 打赏
  • 举报
回复

01.#region 合并单元格(自动合并转为人工合并)
02.private void SetMergeCells(Infragistics.WebUI.UltraWebGrid.UltraWebGrid uwgReport,string key)
03.{
04. for (int i = 0; i < uwgReport.Columns.Count; i++)
05. {
06. string str = "";
07. string text = "";
08. int num2 = 0;
09.
10. if (uwgReport.Columns[i].MergeCells)
11. {
12. uwgReport.Columns[i].MergeCells = false;
13.
14. if (uwgReport.Rows.Count > 0)
15. {
16. text = uwgReport.Rows[0].Cells.FromKey(key).Text;
17.
18. for (int j = 0; j < uwgReport.Rows.Count; j++)
19. {
20. str = uwgReport.Rows[j].Cells.FromKey(key).Text;
21.
22. if (str != text)
23. {
24. text = str;
25. uwgReport.Rows[num2].Cells[i].ColSpan = 1;
26. uwgReport.Rows[num2].Cells[i].RowSpan = j - num2;
27. num2 = j;
28. }
29. }
30. uwgReport.Rows[num2].Cells[i].ColSpan = 1;
31. uwgReport.Rows[num2].Cells[i].RowSpan = uwgReport.Rows.Count - num2;
32. }
33. }
34. }
35.}
36.#endregion
zjybushiren88888 2010-12-08
  • 打赏
  • 举报
回复
求高手指点
骑猪看海 2010-12-08
  • 打赏
  • 举报
回复
没用过,不错应该也就差不多那样
jeven_xiao 2010-12-08
  • 打赏
  • 举报
回复
爱莫能助~·顶一下
deoing 2010-12-07
  • 打赏
  • 举报
回复
没用过UltraWebGrid,不过合并单元格的话,可以给个例子:

/*
* 功能说明:把传入的所有单元格中连续的且内容一样的合并,通常是针对于垂直方向相邻的连续单元格
* 函数用法:传入一个jquery选择器表达式即可,如:mergeTd("#tb .td0")
* 用法举例:如想把某表格(其id是tb)的第一列进行合并操作,可以把第一列的单元格的样式名全部设置为td0,然后调用mergeTd("#tb .td0")
* 使用须知:需要引用jquery1.2.3
*/
function mergeTd(tdCls,attrName,isDebug)
{
if(!attrName)
{
attrName="rowspan";
}
if(typeof isDebug=="undefined")
{
isDebug=false;
}
var rowspan=1;
var first=null;
var lastHtml=null;
var tmpNode=null;
var currHtml="";
if(isDebug)
{
document.write(tdCls+"<br>");
}
$(tdCls).each(
function()
{
currHtml=$(this).html();
if(currHtml==lastHtml)
{
rowspan++;
if(isDebug)
{
$(this).css("color","red");
$(this).html("需要删除");
tmpNode.html(attrName+"="+rowspan);
}
else
{
$(this).remove();
tmpNode.attr(attrName,rowspan);
}
}
else
{
tmpNode=$(this);
if(isDebug)
{
tmpNode.css("color","green");
}
lastHtml=currHtml;
rowspan=1;
}
});
}

zjybushiren88888 2010-12-07
  • 打赏
  • 举报
回复
沙发 等待高手指点 多谢~

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧