PDA

View Full Version : [CLOSED] No data is being loaded in the gridpanel.!!



arjunrvasisht
Jan 12, 2015, 12:40 PM
Hello all,
Can anyone tell me why is my below code not displaying any data.


<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>



<!DOCTYPE html>

<html>
<head id="Head1" runat="server">
<title>ComponentColumn Editor - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />
<style type="text/css">
.WhiteColorForERLEntry {
/*background-color: White;*/
color: Black;
text-align: center;
font-weight: bold;
}

.RedColorForERLEntry {
background-color: #FF0000; /* Red Color */
color: white;
text-align: center;
font-weight: bold;
}

.YellowColorForERLEntry {
background-color: #FFFF00;
color: Black; /*background-color:Green;*/
text-align: center;
font-weight: bold;
}

.RedColorLightForERLEntry {
background-color: #FF8080; /* Red Color */
color: white;
text-align: center;
font-weight: bold;
}

.GreenColorLightForERLEntry {
background-color: #C2FFA3;
color: Black;
text-align: center;
font-weight: bold;
}

.GrayColorLightForERLEntry {
background-color: #d4d0c8;
color: Black;
text-align: center;
font-weight: bold;
}

.GreenColorForERLEntry {
background-color: #008000;
color: white; /*background-color:Green;*/
text-align: center;
font-weight: bold;
}
</style>
<script type="text/javascript">
var getCssClass = function (combo, values) {
// debugger;
//var value = values[combo.valueField];
var value = values.field1;
if (value == 1) {
value = "1";
}
else if (value == -1)
{ value = "-1"; }
else if (value == 2)
{ value = "2"; }
else if (value == 3)
{ value = "3"; }
else if (value == 4)
{ value = "4"; }
else if (value == 5)
{ value = "5"; }
else if (value == 6)
{ value = "6"; }
else
{ }
switch (value) {
case '-1': return 'WhiteColorForERLEntry';
case '1': return 'RedColorForERLEntry';
case '2': return 'RedColorLightForERLEntry';
case '3': return 'YellowColorForERLEntry';
case '4': return 'GreenColorLightForERLEntry';
case '5': return 'GreenColorForERLEntry';
case '6': return 'GrayColorLightForERLEntry';
default: return 'WhiteColorForERLEntry';
}
};
</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />

<h1>ComponentColumn as Editor</h1>

<ext:GridPanel ID="GridPanel1"
runat="server"
Height="580" Width="893" AutoScroll="true"
AutoWidth="false">
<Store>
<ext:Store ID="StoreERL" runat="server">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="ERLMetricId" Type="String" />
<ext:ModelField Name="ERLId" Type="Int" />
<ext:ModelField Name="ERLName" Type="String" />
<ext:ModelField Name="MaturityId_Copy" Type="String" />
<ext:ModelField Name="MaturityId" Type="String" />
<ext:ModelField Name="Comment_Copy" Type="String" />
<ext:ModelField Name="Comment" Type="String" />
<ext:ModelField Name="MaturityName" Type="String" />
<ext:ModelField Name="ColorName" Type="String" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:RowNumbererColumn ID="RowNumbererColumn1" runat="server" />
<ext:Column ID="Column1" runat="server" Header="Level 1 ERL" DataIndex="ERLName" Width="275" Sortable="false"
MenuDisabled="true" Css="text-align:left;word-break:break-all;" ColumnID="Level1ERL" />
<ext:ComponentColumn ID="ComponentColumn2"
runat="server"
Editor="true"
DataIndex="MaturityId"
Flex="1"
Text="ComboBox">
<Component>
<ext:ComboBox ID="ComboBox1" runat="server" Flex="1" NoteAlign="Top"
Width="150" Selectable="true" EnableKeyEvents="true"
TypeAhead="true"
QueryMode="Local" SelectOnFocus="true" ForceSelection="true">
<Items>
<ext:ListItem Text="--Select Maturity--" Value="-1" />
<ext:ListItem Text="Gaps" Value="1" />
<ext:ListItem Text="Disconnects" Value="2" />
<ext:ListItem Text="Actions" Value="3" />
<ext:ListItem Text="In Place" Value="4" />
<ext:ListItem Text="Proven" Value="5" />
<ext:ListItem Text="N/A" Value="6" />
</Items>
<ListConfig OverItemCls="setErlMaturityClass">
<ItemTpl ID="ItemTpl1" runat="server">
<Html>
<div class="{[getCssClass(App.ComboBox1, values)]}">{field2}</div>
<%--<div class="{[xindex == 1 ? 'WhiteColorForERLEntry' : xindex == 2 ? 'RedColorForERLEntry' : xindex == 3 ? 'RedColorLightForERLEntry': xindex == 4 ? 'YellowColorForERLEntry': xindex == 5 ? 'GreenColorLightForERLEntry': xindex == 6 ? 'GreenColorForERLEntry': xindex == 7 ? 'GrayColorLightForERLEntry' : 'WhiteColorForERLEntry']}">{field2}</div>--%>
</Html>
</ItemTpl>
</ListConfig>
</ext:ComboBox>
</Component>
</ext:ComponentColumn>

<ext:Column ID="Column2" runat="server" Align="Center" Header="ERL Maturity" DataIndex="MaturityName" Width="150" Sortable="false"
MenuDisabled="true" Css="text-align:left;word-break:break-all;" ColumnID="ErlMaturityName" Hidden="true">
<%--<Renderer Fn="MaturityLevel_Renderer" />--%>
</ext:Column>

<ext:ComponentColumn ID="ComponentColumn1" runat="server" Header="Remarks (80 char max)" DataIndex="Comment" Width="425" MenuDisabled="true"
Resizable="false" Sortable="false" ColumnID="ErlComments" Editor="true" AutoScroll="false" OverflowX="Hidden" OverflowY="Hidden">
<Component>
<ext:TextField ID="TxtErlComment1" runat="server" MaxLength="80" EnforceMaxLength="true" Grow="false" MaskRe="[^<>]" OverflowX="Hidden" OverflowY="Hidden"
Height="21" EnableKeyEvents="true" RowSpan="0" EmptyText="Insert remarks here..." AutoScroll="false" PreventScrollbars="true">
<Listeners>
<%-- <KeyPress Fn="DisableKeyPress" />
<SpecialKey Fn="PreventEscape" PreventDefault="true" />--%>
</Listeners>
</ext:TextField>
</Component>
</ext:ComponentColumn>

<ext:Column ID="Column3" runat="server" Header="Remarks (80 char max)" DataIndex="Comment" Width="425" Sortable="false"
MenuDisabled="true" Css="text-align:left;word-break:break-all;" ColumnID="ErlCommentsLabel" Hidden="true">
</ext:Column>
</Columns>
</ColumnModel>
</ext:GridPanel>


<ext:ComboBox Flex="1" runat="server" ID="cmboErlMaturity" NoteAlign="Top"
Width="150" Selectable="true" EnableKeyEvents="true"
TypeAhead="true"
QueryMode="Local" SelectOnFocus="true" Editable="true">
<Items>
<ext:ListItem Text="--Select Maturity--" Value="-1" />
<ext:ListItem Text="Gaps" Value="1" />
<ext:ListItem Text="Disconnects" Value="2" />
<ext:ListItem Text="Actions" Value="3" />
<ext:ListItem Text="In Place" Value="4" />
<ext:ListItem Text="Proven" Value="5" />
<ext:ListItem Text="N/A" Value="6" />
</Items>
<ListConfig OverItemCls="setErlMaturityClass">

<ItemTpl ID="ItemTpl2" runat="server">
<Html>
<div class="{[ getCssClass(App.cmboErlMaturity, values) ]}">{field2}</div>
</Html>
</ItemTpl>

</ListConfig>
</ext:ComboBox>
</form>
</body>
</html>



page load:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Honeywell.Ap3.WebApp.Pages
{
public partial class bgcolorPOC : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string path = "C:/AP3/06-SourceCode/AP3 2012/Honeywell.Ap3.WebApp/TechIndicatorPrasoon.xml";
System.Data.DataSet ds = new System.Data.DataSet();
ds.ReadXml(path);

StoreERL.DataSource = ds.Tables[0];
StoreERL.DataBind();
}
}
}


xml file for grid input:


<?xml version="1.0" encoding="utf-8" ?>
<TechIndicator_Table>
<TechIndicator>
<ERLMetricId>4163</ERLMetricId>
<ERLId>1</ERLId>
<ERLName>wedwed</ERLName>
<MaturityId>4</MaturityId>
<MaturityId_Copy>4</MaturityId_Copy>
<MaturityName>In Place</MaturityName>
<ColorName>LightGreen</ColorName>
<ProgramId>1162</ProgramId>
<ProgramName>dewdewd</ProgramName>
<Comment>wedwd</Comment>
<Comment_Copy>wede</Comment_Copy>
</TechIndicator>
</TechIndicator_Table>

Daniil
Jan 12, 2015, 2:03 PM
Hi @arjunrvasisht,

Running your test case I see the following on the screen.
http://forums.ext.net/attachment.php?attachmentid=18711&stc=1

It appears the data is loaded correctly for me.

How does it look for you?

geoffrey.mcgill
Jan 12, 2015, 2:07 PM
Hello arjunrvasisht,

You have a lot of code that I doubt is related to the problem. First step would be simplify your code sample down to the absolute minimum required to reproduce the problem. That should take no more than 100 lines of code.

As well, please combine all your code into one file that can be copy + paste directly into a test project. We shouldn't have to piece together a bunch of your code in an attempt to get the sample working.

More tips are available in the Forum Guidelines, please review.

http://forums.ext.net/showthread.php?10205-More-Information-Required

Are you getting a JavaScript error? Have you debugged the code? Where is it failing? What steps have you taken to narrow down the problem?