FineUI 官方论坛
标题:
急!!!请各位高手支招!!
[打印本页]
作者:
wtjzx
时间:
2014-9-16 10:13
标题:
急!!!请各位高手支招!!
我有一个页面,用了tabstrips,放了2个tab,每个tab下绑定了一个Grid,2个grid都允许分页,但页面展示时只有第一个tab中的grid显示了分页条,第二个tab中的grid不显示。各位高手,如何解决啊?
作者:
xxdddail
时间:
2014-9-16 11:21
指定grid和tab的高度
作者:
wtjzx
时间:
2014-9-16 12:00
grid和tab的高度都指定了,不行。我认为在页面加载的时候系统默认tab1是当前激活的tab页,tab1上的grid显示了分页工具条,而tab2由于不是激活状态,所以在grid构建时就没有显示。如果我把tabtrips的activetabindex设置为1,则第二个tab显示工具条,第一个又不显示了。
作者:
xxdddail
时间:
2014-9-16 13:42
我的项目中,在TabScript已经放了七八个tab,几乎都有Grid数据,并没有出现上述的情况。不知,你用的是FineUI的哪一个版本
作者:
admin1
时间:
2014-9-16 15:51
你可以吧代码贴出了给大家看看你那里出错
作者:
wtjzx
时间:
2014-9-17 12:20
我用的版本较低,fineui 3.2.3
作者:
wtjzx
时间:
2014-9-17 12:31
aspx页面代码:
<ext:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<ext:Panel ID="Panel1" runat="server" ShowBorder="false" ShowHeader="false" EnableBackgroundColor="true" EnableCollapse="false" Layout="Fit" >
<Items>
<ext:TabStrip ID="TabStrip1" runat="server" ActiveTabIndex="0" ShowBorder="True" OnTabIndexChanged="TabStrip1_TabIndexChanged">
<Tabs>
<ext:Tab runat="server" BodyPadding="5px" EnableBackgroundColor="true"
Title="标记规章" ID="tab_sign" >
<Toolbars>
<ext:Toolbar ID="toolbar2" runat="server">
<Items>
<ext:Button ID="btn_nosign" runat="server" Icon="PencilDelete" Text="取消已选标记" OnClick="btn_nosign_Click"></ext:Button>
<ext:Button ID="btn_nosign_all" runat="server" Icon="PencilGo" Text="取消全部标记" OnClick="btn_nosign_all_Click"></ext:Button>
</Items>
</ext:Toolbar>
</Toolbars>
<Items>
<ext:Grid ID="gd_sign" AllowPaging="true" AllowSorting="true" AutoScroll="true" DataKeyNames="gzid,fwzh" PageSize="15"
EnableBackgroundColor="true" EnableCheckBoxSelect="true" EnableMultiSelect="true" EnableRowDoubleClick="true"
runat="server" SortColumn="gzid" SortDirection="ASC" ShowHeader="false" OnRowCommand="gd_sign_RowCommand" OnSort="gd_sign_Sort" OnPageIndexChange="gd_sign_PageIndexChange" OnRowDoubleClick="gd_sign_RowDoubleClick" Height="600px">
<Columns>
<ext:BoundField ColumnID="gzid" DataField="gzid" SortField="gzid" HeaderText="规章编号" TextAlign="Center" Width="100px" />
<ext:BoundField ColumnID="fwzh" DataField="fwzh" SortField="fwzh" HeaderText="发文字号" TextAlign="Center" Width="150px" />
<ext:BoundField ColumnID="gzbt" DataField="gzbt" SortField="gzbt" HeaderText="规章标题" TextAlign="Center" ExpandUnusedSpace="true"/>
<ext:BoundField ColumnID="gzdj" DataField="gzdj" SortField="gzdj" HeaderText="规章等级" TextAlign="Center" />
<ext:BoundField ColumnID="gzfl" DataField="gzfl" SortField="gzfl" HeaderText="规章分类" TextAlign="Center" />
<ext:BoundField ColumnID="gzxf" DataField="gzxf" SortField="gzxf" HeaderText="规章细分" TextAlign="Center" />
<ext:HyperLinkField ColumnID="detail1" DataNavigateUrlFields="wjm" DataNavigateUrlFormatString="/FilesUpLoad/gzfile/{0}" HeaderText="查看附件" ToolTip="点击查看附件信息" TextAlign="Center" Width="60px" Text="查看附件"/>
<ext:LinkButtonField ColumnID="col_op2" HeaderText="标记规章" Icon="PencilDelete" TextAlign="Center" ToolTip="取消标记" CommandName="NoSign" />
</Columns>
</ext:Grid>
</Items>
</ext:Tab>
<ext:Tab runat="server" BodyPadding="5px" EnableBackgroundColor="true"
Title="未标记规章" ID="tab_nosign">
<Toolbars>
<ext:Toolbar ID="toolbar1" runat="server" >
<Items>
<ext:Button ID="btn_sign" runat="server" Icon="PencilAdd" Text="标记已选规章" OnClick="btn_sign_Click"></ext:Button>
<ext:Button ID="btn_sign_all" runat="server" Icon="PencilGo" Text="标记全部规章" OnClick="btn_sign_all_Click"></ext:Button>
</Items>
</ext:Toolbar>
</Toolbars>
<Items>
<ext:Grid ID="gd_nosign" AllowPaging="true" AllowSorting="true" AutoScroll="true" DataKeyNames="gzid,fwzh" PageSize="15"
EnableBackgroundColor="true" EnableCheckBoxSelect="true" EnableMultiSelect="true" EnableRowDoubleClick="true"
runat="server" SortColumn="gzid" SortDirection="ASC" ShowHeader="false" OnRowCommand="gd_nosign_RowCommand" OnSort="gd_nosign_Sort" OnPageIndexChange="gd_nosign_PageIndexChange" OnRowDoubleClick="gd_nosign_RowDoubleClick" Height="600px">
<Columns>
<ext:BoundField ColumnID="gzid" DataField="gzid" SortField="gzid" HeaderText="规章编号" TextAlign="Center" Width="100px" />
<ext:BoundField ColumnID="fwzh" DataField="fwzh" SortField="fwzh" HeaderText="发文字号" TextAlign="Center" Width="150px" />
<ext:BoundField ColumnID="gzbt" DataField="gzbt" SortField="gzbt" HeaderText="规章标题" TextAlign="Center" ExpandUnusedSpace="true"/>
<ext:BoundField ColumnID="gzdj" DataField="gzdj" SortField="gzdj" HeaderText="规章等级" TextAlign="Center" />
<ext:BoundField ColumnID="gzfl" DataField="gzfl" SortField="gzfl" HeaderText="规章分类" TextAlign="Center" />
<ext:BoundField ColumnID="gzxf" DataField="gzxf" SortField="gzxf" HeaderText="规章细分" TextAlign="Center" />
<ext:HyperLinkField ColumnID="detail1" DataNavigateUrlFields="wjm" DataNavigateUrlFormatString="/FilesUpLoad/gzfile/{0}" HeaderText="查看附件" ToolTip="点击查看附件信息" TextAlign="Center" Width="60px" Text="查看附件"/>
<ext:LinkButtonField ColumnID="col_op2" HeaderText="标记规章" Icon="PencilAdd" TextAlign="Center" ToolTip="标记该规章" CommandName="Sign" />
</Columns>
</ext:Grid>
</Items>
</ext:Tab>
</Tabs>
</ext:TabStrip>
</Items>
</ext:Panel>
复制代码
作者:
wtjzx
时间:
2014-9-17 12:32
cs代码如下:
public partial class Gz_Sign : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.BindSignGrid();
this.BindNoSignGrid();
}
}
#region 绑定事件
protected void BindSignGrid()
{
ExtAspNet.GridColumn gc = gd_sign.FindColumn(gd_sign.SortColumn);
this.BindGridwithSort(gc.SortField, gd_sign.SortDirection,gd_sign,"1");
}
protected void BindNoSignGrid()
{
ExtAspNet.GridColumn gc = gd_nosign.FindColumn(gd_nosign.SortColumn);
this.BindGridwithSort(gc.SortField, gd_nosign.SortDirection, gd_nosign, "0");
}
protected void BindGridwithSort(string sortField, string sortDirection,ExtAspNet.Grid gd,string sign)
{
string _sql = "select * from m_gzml where bmid='2312100' and zt='发布' and sfbj='"+sign+"'";
DataTable dtb = DbHelperOra.GetDataSet(_sql, CommandType.Text);
DataView dv = dtb.DefaultView;
dv.Sort = String.Format("{0} {1}", sortField, sortDirection);
gd.DataSource = dv;
gd.DataBind();
}
#endregion
#region 页面函数
protected void Sign_gz(string gzid)
{
Business.OracleField[] arrList = new Business.OracleField[1];
Business.OracleField field = new Business.OracleField();
field.p_datatype = "string";
field.p_fieldname = "sfbj";
field.p_fieldvalue = "1";
arrList[0] = field;
string con = " where gzid = to_number('" + gzid + "')";
string update_sql = Business.GetUpdateSql("m_gzml", arrList, con);
DbHelperOra.ExecuteSql(update_sql);
}
protected void No_Sign_gz(string gzid)
{
Business.OracleField[] arrList = new Business.OracleField[1];
Business.OracleField field = new Business.OracleField();
field.p_datatype = "string";
field.p_fieldname = "sfbj";
field.p_fieldvalue = "0";
arrList[0] = field;
string con = " where gzid = to_number('" + gzid + "')";
string update_sql = Business.GetUpdateSql("m_gzml", arrList, con);
DbHelperOra.ExecuteSql(update_sql);
}
#endregion
#region 事件
protected void gd_nosign_Sort(object sender, ExtAspNet.GridSortEventArgs e)
{
this.BindGridwithSort(e.SortField, e.SortDirection, gd_nosign, "0");
}
protected void gd_sign_Sort(object sender, ExtAspNet.GridSortEventArgs e)
{
this.BindGridwithSort(e.SortField, e.SortDirection, gd_sign, "1");
}
protected void gd_nosign_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e)
{
gd_nosign.PageIndex = e.NewPageIndex;
}
protected void gd_sign_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e)
{
gd_sign.PageIndex = e.NewPageIndex;
}
protected void gd_nosign_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e)
{
if (e.CommandName == "Sign")
{
string gzid = gd_nosign.Rows[e.RowIndex].DataKeys[0].ToString();
this.Sign_gz(gzid);
Alert.ShowInTop("规章标记成功!");
this.BindSignGrid();
this.BindNoSignGrid();
}
}
protected void gd_sign_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e)
{
if (e.CommandName == "NoSign")
{
string gzid = gd_sign.Rows[e.RowIndex].DataKeys[0].ToString();
this.No_Sign_gz(gzid);
Alert.ShowInTop("取消标记规章成功!");
this.BindSignGrid();
this.BindNoSignGrid();
}
}
protected void btn_sign_Click(object sender, EventArgs e)
{
if (gd_nosign.SelectedRowIndexArray.Length > 0)
{
foreach (int row in gd_nosign.SelectedRowIndexArray)
{
string gzid = gd_nosign.DataKeys[row][0].ToString();
this.Sign_gz(gzid);
}
this.BindNoSignGrid();
this.BindSignGrid();
Alert.ShowInTop("已将已选规章进行标记!");
}
else { Alert.Show("没有需要标记的规章!"); }
}
protected void btn_sign_all_Click(object sender, EventArgs e)
{
if (gd_nosign.Rows.Count > 0)
{
foreach (ExtAspNet.GridRow row in gd_nosign.Rows)
{
string gzid = row.DataKeys[0].ToString();
this.Sign_gz(gzid);
}
this.BindNoSignGrid();
this.BindSignGrid();
Alert.ShowInTop("已将全部规章进行标记!");
}
else
{
Alert.Show("没有规章需要标记!");
}
}
protected void btn_nosign_Click(object sender, EventArgs e)
{
if (gd_sign.SelectedRowIndexArray.Length > 0)
{
foreach (int row in gd_sign.SelectedRowIndexArray)
{
string gzid = gd_sign.DataKeys[row][0].ToString();
this.No_Sign_gz(gzid);
}
this.BindNoSignGrid();
this.BindSignGrid();
Alert.ShowInTop("已取消所选规章标记!");
}
else
{
Alert.Show("没有标记规章需取消!");
}
}
protected void btn_nosign_all_Click(object sender, EventArgs e)
{
if (gd_sign.Rows.Count > 0)
{
foreach (ExtAspNet.GridRow row in gd_sign.Rows)
{
string gzid = row.DataKeys[0].ToString();
this.No_Sign_gz(gzid);
}
this.BindNoSignGrid();
this.BindSignGrid();
Alert.ShowInTop("已取消全部规章标记!");
}
else
Alert.Show("没有标记规章需取消!");
}
protected void gd_nosign_RowDoubleClick(object sender, ExtAspNet.GridRowClickEventArgs e)
{
string url = "Gz_View.aspx?gzid=" + gd_nosign.Rows[e.RowIndex].DataKeys[0].ToString();
PageContext.RegisterStartupScript(Window1.GetShowReference(url, "查看规章"));
}
protected void gd_sign_RowDoubleClick(object sender, ExtAspNet.GridRowClickEventArgs e)
{
string url = "Gz_View.aspx?gzid=" + gd_sign.Rows[e.RowIndex].DataKeys[0].ToString();
PageContext.RegisterStartupScript(Window1.GetShowReference(url, "查看规章"));
}
protected void TabStrip1_TabIndexChanged(object sender, EventArgs e)
{
if (TabStrip1.ActiveTabIndex == 0)
{
this.BindSignGrid();
}
else
{
this.BindNoSignGrid();
}
}
#endregion
}
复制代码
作者:
sanshi
时间:
2014-9-17 12:42
Tab里只有一个Grid的话,给Tab加上Layout=fit。
如果还有问题,请用空项目创建重现问题的示例,方便调试解决
作者:
wtjzx
时间:
2014-9-17 14:52
问题已解决,谢谢三石!
欢迎光临 FineUI 官方论坛 (https://fineui.com/BBS/)
Powered by Discuz! X3.4