Infragistics.WebUI.UltraWebGrid功能强大,但是缺乏详细地说明文档,虽然有例子,但是每次遇到问题都要对照页面
一个一个去找,实在太麻烦。下面是关于一些Infragistics.WebUI.UltraWebGrid使用的小技巧,避免忘记了再去找。
1.如果设定了RowEditTemplate,请在DisplayLayout中设定
CellClickActionDefault="RowSelect" AllowUpdateDefault="Yes"
<
Bands
>
<
igtbl:UltraGridBand
>
<
RowEditTemplate
>
</
RowEditTemplate
>
<
RowTemplateStyle
BackColor
="Window"
BorderColor
="Window"
BorderStyle
="Ridge"
>
<
BorderDetails
WidthBottom
="3px"
WidthLeft
="3px"
WidthRight
="3px"
WidthTop
="3px"
/>
</
RowTemplateStyle
>
<
AddNewRow
Visible
="NotSet"
View
="NotSet"
></
AddNewRow
>
</
igtbl:UltraGridBand
>
</
Bands
>
CellClickActionDefault="RowSelect"表明单元格单击选择行,AllowUpdateDefault="Yes"允许编辑
2.去掉讨厌的左边空白列。其实这是个默认的行选择器,如果要去掉
请在DisplayLayout中设定
RowSelectorsDefault="No"
3.还要设定行模板的样式,否则你可定设置了上面的,但是还是当鼠标单击行的时候,模板还是不出来。
<
RowTemplateStyle BackColor
=
"
Window
"
BorderColor
=
"
Window
"
BorderStyle
=
"
Ridge
"
Height
=
"
210px
"
Width
=
"
360px
"
>
<
BorderDetails WidthBottom
=
"
0px
"
WidthLeft
=
"
0px
"
WidthRight
=
"
0px
"
WidthTop
=
"
0px
"
/>
</
RowTemplateStyle
>
4.行模板的关闭和取消按钮就是默认的,不要改动,否则可能出现一些错误
<
input
type
="button"
id
="igtbl_reOkBtn"
value
=" 确 定 "
class
="btn"
onclick
="igtbl_gRowEditButtonClick(event);"
/>
<
input
type
="button"
id
="igtbl_reCancelBtn"
value
=" 关 闭 "
class
="btn"
onclick
="igtbl_gRowEditButtonClick(event);"
/>
5.添加行模板打开和关闭事件
UltraWebGrid1.DisplayLayout.ClientSideEvents.AfterRowTemplateOpenHandler
=
"
Template_AfterRowTemplateOpenHandler
"
;
UltraWebGrid1.DisplayLayout.ClientSideEvents.AfterRowTemplateCloseHandler
=
"
Template_AfterRowTemplateCloseHandler
"
;
6.添加行模板打开和关闭的客户端响应事件
//
打开行模板
function
Template_AfterRowTemplateOpenHandler(gridName, rowId)
{
CurrentGrid
=
igtbl_getGridById(UltraWebGrid1);
CurrentRow
=
igtbl_getRowById(rowId);
CurrentRowIndex
=
CurrentRow.getIndex();
//
具体的处理逻辑
}
//
关闭行模板
function
Template_AfterRowTemplateCloseHandler(gridName, rowId, bSaveChanges)
{
if
(bSaveChanges
==
false
)
return
;
//
具体的处理逻辑
}
先说这几个,陆续补充中...