Grid panel header was not displaying

Page 1 of 2 12 LastLast
  1. #1

    Grid panel header was not displaying

    Grid panel header was not displaying when i open an view page, how to display grid panel header rows all time.
  2. #2
    Please post a complete (but simplified) code sample demonstrating how to reproduce the issue.
  3. #3
    Be sure that you're not setting GridPanel's HideHeaders to true.
  4. #4
    The following example may help you.

    Click image for larger version. 

Name:	gp001.png 
Views:	2 
Size:	6.6 KB 
ID:	20851

    <!DOCTYPE html>
    <html>
    <head runat="server">
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:GridPanel Title="Ext.Net" Border="true" Width="500" Height="370" runat="server">
            <Store>
                <ext:Store AutoLoad="true" runat="server">
                    <Proxy>
                        <ext:AjaxProxy Url="~/Example/LoadFakeRecords/">
                            <ActionMethods Read="POST" />
                            <Reader>
                                <ext:JsonReader RootProperty="data" />
                            </Reader>
                        </ext:AjaxProxy>
                    </Proxy>
                    <Model>
                        <ext:Model IDProperty="ID" runat="server">
                            <Fields>
                                <ext:ModelField Name="ID" Type="String" />
                                <ext:ModelField Name="Name" Type="String" />
                                <ext:ModelField Name="LastName" Type="String" />
                                <ext:ModelField Name="Address" Type="String" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Text="ID" DataIndex="ID" runat="server" />
                    <ext:Column Text="Name" Flex="1" DataIndex="Name" runat="server" />
                    <ext:Column Text="Last Name" DataIndex="LastName" runat="server" />
                    <ext:Column Text="Address" DataIndex="Address" runat="server" />
                </Columns>
            </ColumnModel>
        </ext:GridPanel>
    </body>
    </html>
    namespace SandBox.Controllers
    {
        public class ExampleController : System.Web.Mvc.Controller
        {
            public ActionResult Index()
            {
                return View();
            }
    
            public StoreResult LoadFakeRecords()
            {
                List<Entity> lst = new List<Entity>();
    
                for (int index = 0; index < 15; index++)
                {
                    lst.Add(new Entity
                    {
                        ID = index,
                        Name = string.Format("Name - {0}", index),
                        LastName = string.Format("Last Name - {0}", index),
                        Address = string.Format("Address - {0}", index)
                    });
                }
    
                return new StoreResult(lst, lst.Count());
            }
        }
    
        public class Entity
        {
            public int ID { get; set; }
    
            public string Name { get; set; }
    
            public string LastName { get; set; }
    
            public string Address { get; set; }
        }
    }
  5. #5
    i have created a grid panel for role based designation of an employee, and it was suppose to display as shown below image
    Click image for larger version. 

Name:	Desg-2.jpg 
Views:	2 
Size:	39.1 KB 
ID:	20921

    Code for the grid panel is

    @(Html.X().GridPanel()
                                                        .ID("GPDesignation")
                                                            .Width(1158)
                                                            .Height(260)
                                                            .Header(true)
                                                            .Store(Html.X().Store()
                                                            .PageSize(10)
                                                            .ID("SDesignation")
                                                            .Model(Html.X().Model()
                                                            .Fields(
                                                                new ModelField("ROLE_CODE", ModelFieldType.String),
                                                                new ModelField("ROLE_DESC", ModelFieldType.String),
                                                                 new ModelField("DESIGNATION_CODE", ModelFieldType.String),
                                                                 new ModelField("DESIGNATION_DESC", ModelFieldType.String),
                                                                  new ModelField("DEFAULT_DESIG", ModelFieldType.String)
                                                                )
                                                            )
                                                        )
                                                        .ColumnModel(
                                                            Html.X().Column().Text("Role").DataIndex("ROLE_CODE").Width(150),
                                                            Html.X().Column().Text("Role Description").DataIndex("ROLE_DESC").Width(326),
                                                            Html.X().Column().Text("Designation").DataIndex("DESIGNATION_CODE").Width(250),
                                                            Html.X().Column().Text("DSG Description").DataIndex("DESIGNATION_DESC").Width(326),
                                                            Html.X().Column().Text("Default").DataIndex("DEFAULT_DESIG").Width(100)
                                                        )
                                                        .SelectionModel(Html.X().RowSelectionModel().Listeners(ls => ls.Select.Fn = "GridSelect"))
                                                        )
    Data's binded to the grid using ajax jsonResult

    public JsonResult Bind_Destination(string EMP_CODE)
            {
                 List<Designation_Model> Designationlist = new List<Designation_Model>();
                 try
                 {
                     InitializeDB();
                     List<DbParams> collection = new List<DbParams>();
                     collection.Add(new DbParams(DbType.String, 50, "BindEmployeeDestinationgrid", "@Mode", ParameterDirection.Input));
                     collection.Add(new DbParams(DbType.String, 200, EMP_CODE, "@EMP_CODE", ParameterDirection.Input));
                     DataSet ds = ObjDbfactory.GetData("SP_Employee", false, collection);
    
                     foreach (DataRow dr in ds.Tables[0].Rows)
                     {
                         Designationlist.Add(new Designation_Model
                         {
                             ROLE_CODE = Convert.ToString(dr["ROLE_CODE"]),
                             ROLE_DESC = Convert.ToString(dr["ROLE_DESC"]),
                             DESIGNATION_CODE = Convert.ToString(dr["DESIGNATION_CODE"]),
                             DESIGNATION_DESC = Convert.ToString(dr["DESIGNATION_DESC"]),
                             DEFAULT_DESIG = Convert.ToString(dr["DEFAULTDES"])
                         }
                         );
                     }
                 }
                 catch (Exception ex)
                 {
                     SaveError_Log("Employee", "Setup", ex.Message);
                 }
                return Json(Designationlist, JsonRequestBehavior.AllowGet);
            }
    and now the grid was displaying as shown below image without header.
    Click image for larger version. 

Name:	Desg-1.jpg 
Views:	7 
Size:	23.3 KB 
ID:	20911

    kindly provide me some suggestion, and let me know what i had done wrong in it.
  6. #6
    In the morning i am gonna review it.
  7. #7
    Please post a complete (but simplified) code sample demonstrating how to reproduce the issue.

    Some more details are in our forums guidelines.
    Forum Guidelines For Posting New Topics
    More Information Required
  8. #8
    By running your code
    @(Html.X().GridPanel()
        .ID("GPDesignation")
        .Width(1158)
        .Height(260)
        .Header(true)
        .Store(Html.X().Store()
        .PageSize(10)
        .ID("SDesignation")
        .Model(Html.X().Model()
        .Fields(
            new ModelField("ROLE_CODE", ModelFieldType.String),
            new ModelField("ROLE_DESC", ModelFieldType.String),
            new ModelField("DESIGNATION_CODE", ModelFieldType.String),
            new ModelField("DESIGNATION_DESC", ModelFieldType.String),
            new ModelField("DEFAULT_DESIG", ModelFieldType.String)
            )
        )
    )
    .ColumnModel(
        Html.X().Column().Text("Role").DataIndex("ROLE_CODE").Width(150),
        Html.X().Column().Text("Role Description").DataIndex("ROLE_DESC").Width(326),
        Html.X().Column().Text("Designation").DataIndex("DESIGNATION_CODE").Width(250),
        Html.X().Column().Text("DSG Description").DataIndex("DESIGNATION_DESC").Width(326),
        Html.X().Column().Text("Default").DataIndex("DEFAULT_DESIG").Width(100)
    )
    .SelectionModel(Html.X().RowSelectionModel())
    )
    I get the following result
    Click image for larger version. 

Name:	gp003.png 
Views:	6 
Size:	7.0 KB 
ID:	20931
  9. #9
    But for me it displays as shown below, even after loading with or without data.
    Click image for larger version. 

Name:	Desg-1.jpg 
Views:	1 
Size:	23.3 KB 
ID:	20941
  10. #10
    Sundarsureshin, it would be easier to identify the issue if you post a full sample.
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Grid Panel not displaying data on button click
    By otouri in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 05, 2013, 6:30 PM
  2. [CLOSED] Records are not displaying as per pagesize in grid panel
    By alscg in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 04, 2013, 9:54 AM
  3. [CLOSED] Displaying grid panel below text field input
    By MTSI in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 11, 2013, 12:31 PM
  4. Replies: 0
    Last Post: May 01, 2012, 9:43 AM
  5. Replies: 16
    Last Post: Feb 23, 2011, 10:03 AM

Tags for this Thread

Posting Permissions