Oct 04, 2015, 9:26 AM
Hide Gridpanel Column Text based on specific Column Value and Row numbering issue
I am using ext.net 2.5.3 version.
I have grid panel and there is column value "Main office" is binding from backend and It is displaying first row in the grid panel.
But I want to hide the "Main office" column text in the grid panel. It should not hide the whole row.
I just used in the below rowclass handler to check the record contains "Main Office" then I try to hide. But it is not working and I also
facing row numbering issue. It is not show correct row number.
Please help me to hide gridpanel column text based on the column value.
I have grid panel and there is column value "Main office" is binding from backend and It is displaying first row in the grid panel.
But I want to hide the "Main office" column text in the grid panel. It should not hide the whole row.
I just used in the below rowclass handler to check the record contains "Main Office" then I try to hide. But it is not working and I also
facing row numbering issue. It is not show correct row number.
<View>
<ext:GridView ID="GridView1" runat="server">
<GetRowClass Handler="if (record.data.LocationName=='Main Office') {return 'x-item-hidden';}" />
</ext:GridView>
</View>
Please find the test case here.Please help me to hide gridpanel column text based on the column value.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestRowNumber.aspx.cs" Inherits="JobsPor.TestRowNumber" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Import Namespace="System.Collections.Generic" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
this.storeAddress.DataSource = Address.GetAll();
this.storeAddress.DataBind();
}
public class Address
{
public int ID { get; set; }
public string Location { get; set; }
public string Fax { get; set; }
public static List<Address> GetAll()
{
return new List<Address>
{
new Address {ID = 0, Location = "Main Office",Fax=""}
};
}
}
</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>Row Numbering Issue</title>
<link href="/resources/css/examples.css" rel="stylesheet" />
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Store ID="storeAddress" runat="server" >
<Model>
<ext:Model ID="Model3" runat="server" IDProperty="ID">
<Fields>
<ext:ModelField Name="ID" Type="Int" />
<ext:ModelField Name="Location" />
<ext:ModelField Name="Fax" />
</Fields>
<IDGen>
<ext:SequentialIdGenerator />
</IDGen>
</ext:Model>
</Model>
</ext:Store>
<ext:Panel ID="Panel1"
runat="server"
Title="Parent Grid"
Width="600"
Height="200"
Layout="FitLayout">
<Items>
<ext:GridPanel ID="grdpnlEmployerProfile_Address"
Height="100"
runat="server"
Title="Address Grid"
Icon="Application" StoreID="storeAddress">
<TopBar>
<ext:Toolbar ID="tlbrEmployerProfile_Address" runat="server">
<Items>
<ext:Button ID="btnNewEmployerProfile_Address" runat="server" Icon="Add" Text="New">
<Listeners>
<Click Handler="var grid1 = #{grdpnlEmployerProfile_Address},
store1 = grid1.store;
store1.insert(0, {
});
#{grdpnlEmployerProfile_Address}.getView().refresh(false);
#{grdpnlEmployerProfile_Address}.getSelectionModel().select(0);
#{grdpnlEmployerProfile_Address}.getView().focusRow(0);
grid1.editingPlugin.startEdit(0, 1);" />
</Listeners>
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
<ColumnModel ID="ColumnModel2" runat="server">
<Columns>
<ext:RowNumbererColumn ID="RowNumbererColumn2" runat="server" />
<ext:Column ID="Column5" runat="server" Text="Location" DataIndex="Location" >
<Editor>
<ext:TextField ID="txtLocationName" runat="server" AllowBlank="False" MaxLength="20" MinWidth="5"></ext:TextField>
</Editor>
</ext:Column>
<ext:Column ID="Column6" runat="server" Text="Fax" DataIndex="Fax" >
<Editor>
<ext:TextField ID="txtFax" runat="server" AllowBlank="False" MaxLength="20" MinWidth="5"></ext:TextField>
</Editor>
</ext:Column>
</Columns>
</ColumnModel>
<View>
<ext:GridView ID="GridView1" runat="server">
<GetRowClass Handler="if (record.data.LocationName=='Main Office') {return 'x-item-hidden';}" />
</ext:GridView>
</View>
<Listeners>
<Edit Handler="var record = #{grdpnlEmployerProfile_Address}.getSelectionModel().getSelection();"></Edit>
</Listeners>
<Plugins>
<ext:CellEditing ID="CellEditing2" runat="server" />
</Plugins>
</ext:GridPanel>
</Items>
</ext:Panel>
<ext:Label runat="server" ID="lblhidden" Text=""></ext:Label>
<ext:Hidden ID="Hidden1" runat="server"/>
<ext:Button ID="btnSubmitNew" runat="server" Hidden="False"
StandOut="True" Text="Submit">
<Listeners>
</Listeners>
<DirectEvents>
<Click OnEvent="btnSubmit_Click" Timeout="1800000">
<ExtraParams>
<ext:Parameter Name="Save" Mode="Value" Value="NEW" />
</ExtraParams>
<EventMask ShowMask="True" Msg="Processing..." MinDelay="500" />
</Click>
</DirectEvents>
</ext:Button>
</form>
</body>
</html>
Last edited by yenkarthi; Oct 04, 2015 at 9:35 AM.
Reason: change content