PDA

View Full Version : [CLOSED] GetRowClass dont working in ext.net 2.x



farallones
Jun 22, 2013, 4:52 PM
i have the next code but the colors in the grid dont change, in version 1.x working and in the documentation dont show changes about this property.



<%@ Page Title="" Language="C#" MasterPageFile="~/Templates/Site.master" AutoEventWireup="true"
CodeFile="SopConsulta.aspx.cs" Inherits="Soporte_Procesos_SopConsulta" %>


<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
<style type="text/css">
.vencido {
background: #FFAAAA;
}


.porvencer {
background: #AAFFAA;
}


.atiempo {
background: #FFFFAA;
}
</style>
<script type="text/javascript">
var getRowClass = function (record) {
if (record.data.TIEMPOCOL == "A TIEMPO") {
return "atiempo";
}
if (record.data.TIEMPOCOL == "POR CUMPLIR") {
return "porvencer";
}
if (record.data.TIEMPOCOL == "VENCIDO") {
return "vencido";
}
}
</script>
<%-- STORE PARA CARGAR LA GRILLA DE SOPORTES ABIERTOS--%>
<ext:Store ID="StrGridSoportesAbiertos" runat="server" OnReadData="strGridSoportesAbiertos_RefreshData">
<Model>
<ext:Model runat="server" IDProperty="OID">
<Fields>
<ext:ModelField Name="OID" Type="Int">
</ext:ModelField>
<ext:ModelField Name="NOMBRE" Type="String">
</ext:ModelField>
<ext:ModelField Name="NOMBREAREA" Type="String">
</ext:ModelField>
<ext:ModelField Name="TIPO" Type="String">
</ext:ModelField>
<ext:ModelField Name="SPFECHASOL" Type="Date">
</ext:ModelField>
<ext:ModelField Name="RESPONSABLE" Type="String">
</ext:ModelField>
<ext:ModelField Name="TIEMPOCOL" Type="String">
</ext:ModelField>
</Fields>
</ext:Model>
</Model>
<Sorters>
<ext:DataSorter Property="OID" Direction="ASC" />
</Sorters>
</ext:Store>
<%-- FORM PARA CONSULTA DE SOPORTES POR ESTADO--%>
<ext:FormPanel ID="FormPanel1" runat="server" Title="Consulta de Soportes" DefaultButton="1"
BodyPadding="5" AutoWidth="true" ButtonAlign="Center">
<Buttons>
<ext:Button ID="BtnAbiertos" runat="server" Text="En Tramite">
<DirectEvents>
<Click OnEvent="BtnAbiertos_DirectClick">
<EventMask ShowMask="true" Msg="Consultando Datos..." MinDelay="500" />
</Click>
</DirectEvents>
</ext:Button>
<ext:Button ID="BtnPorCalificar" runat="server" Text="Por Calificar">
<DirectEvents>
<Click OnEvent="BtnPorCalificar_DirectClick">
<EventMask ShowMask="true" Msg="Consultando Datos..." MinDelay="500" />
</Click>
</DirectEvents>
</ext:Button>
<ext:Button ID="BtnCerrados" runat="server" Text="Cerrados">
<DirectEvents>
<Click OnEvent="BtnCerrados_DirectClick">
<EventMask ShowMask="true" Msg="Consultando Datos..." MinDelay="500" />
</Click>
</DirectEvents>
</ext:Button>
</Buttons>
</ext:FormPanel>
<%-- GRILLA DE SOPORTES ABIERTOS--%>
<ext:GridPanel ID="GridSoportesAbiertos" runat="server" AutoHeight="true" Title="Soportes Abiertos"
StoreID="StrGridSoportesAbiertos" StripeRows="true" AutoWidth="true">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ColumnID="Oid" runat="server" Header="Oid" Width="40" DataIndex="OID" />
<ext:Column ColumnID="Solicito" runat="server" Header="Solicito" DataIndex="NOMBRE" Width="200"
Sortable="true">
</ext:Column>
<ext:Column ColumnID="Area" runat="server" Header="Area" Width="150" DataIndex="NOMBREAREA" Sortable="true">
</ext:Column>
<ext:Column ColumnID="TipodeSoporte" runat="server" Header="Tipo de Soporte" Width="100" DataIndex="TIPO"
Sortable="true">
</ext:Column>
<ext:Column ColumnID="FechaSolicitud" runat="server" Header="Fecha Solicitud" Width="100" DataIndex="SPFECHASOL"
Sortable="true">
<Renderer Format="Date" FormatArgs="'d/m/Y H:i'" />
</ext:Column>
<ext:Column ColumnID="Responsable" runat="server" Header="Responsable" Width="300" DataIndex="RESPONSABLE"
Sortable="true">
</ext:Column>
<ext:CommandColumn runat="server" Width="50">
<Commands>
<ext:GridCommand Icon="NoteEdit" CommandName="VerSoporte">
<ToolTip Text="Ver Soporte" />
</ext:GridCommand>
</Commands>
<%--CONFIGURACION DE LOS EVENTOS DE LOS BOTONES--%>
<Listeners>
<Command Handler="App.direct.DirectMethod(command, record.data.OID)" />
</Listeners>
</ext:CommandColumn>
</Columns>
</ColumnModel>
<View>
<ext:GridView ID="GridView1" runat="server">
<GetRowClass Fn="getRowClass" />
</ext:GridView>
</View>
<Features>
<%--PARA FILTROS EN LA GRILLA--%>
<ext:GridFilters runat="server" ID="GridFilters1" Local="true">
<Filters>
<ext:StringFilter DataIndex="OID" />
<ext:StringFilter DataIndex="NOMBRE" />
<ext:StringFilter DataIndex="NOMBREAREA" />
<ext:StringFilter DataIndex="TIPO" />
<ext:DateFilter DataIndex="SPFECHASOL" />
<ext:StringFilter DataIndex="RESPONSABLE" />
</Filters>
</ext:GridFilters>
</Features>
<%--PARA SELECCIONAR TODA LA FILA EN LA GRILLA--%>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel" runat="server" SingleSelect="true">
</ext:RowSelectionModel>
</SelectionModel>
<%--PARA COLOCAR BARRA DE OPCIONES INFERIORES EN LA GRILLA--%>
<BottomBar>
<ext:PagingToolbar ID="tbrPaging" runat="server" PageSize="20" EmptyMsg="No hay registros para mostrar" />
</BottomBar>
</ext:GridPanel> </asp:Content>

Baidaly
Jun 24, 2013, 12:35 AM
Hello!

You should specify CSS rules by adding '.x-grid-td' class.



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

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

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.Store1.DataSource = this.Data;
this.Store1.DataBind();
}
}

private object[] Data
{
get
{
return new object[]
{
new object[] { "3m Co", 71.72, 0.02, 0.03, "9/1 12:00am" },
new object[] { "Alcoa Inc", 29.01, 0.42, 1.47, "9/1 12:00am" },
new object[] { "Altria Group Inc", 83.81, 0.28, 0.34, "9/1 12:00am" },
new object[] { "American Express Company", 52.55, 0.01, 0.02, "9/1 12:00am" },
new object[] { "American International Group, Inc.", 64.13, 0.31, 0.49, "9/1 12:00am" },
new object[] { "AT&T Inc.", 31.61, -0.48, -1.54, "9/1 12:00am" },
new object[] { "Boeing Co.", 75.43, 0.53, 0.71, "9/1 12:00am" },
new object[] { "Caterpillar Inc.", 67.27, 0.92, 1.39, "9/1 12:00am" },
new object[] { "JP Morgan & Chase & Co", 45.73, 0.07, 0.15, "9/1 12:00am" },
new object[] { "McDonald\"s Corporation", 36.76, 0.86, 2.40, "9/1 12:00am" },
new object[] { "Merck & Co., Inc.", 40.96, 0.41, 1.01, "9/1 12:00am" },
new object[] { "Microsoft Corporation", 25.84, 0.14, 0.54, "9/1 12:00am" }
};
}
}
</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Simple Array Grid - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />

<style>
.atiempo .x-grid-td {
background: #FFFFAA !important;
}
</style>

<script type="text/javascript">
var getRowClass = function (record) {
if (record.data.company == "Microsoft Corporation") {
return "atiempo";
}
}
</script>
</head>
<body>
<ext:ResourceManager runat="server" />

<ext:GridPanel
ID="GridPanel1"
runat="server"
Title="Array Grid"
Width="600"
Height="350">
<Store>
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="company" />
<ext:ModelField Name="price" Type="Float" />
<ext:ModelField Name="change" Type="Float" />
<ext:ModelField Name="pctChange" Type="Float" />
<ext:ModelField Name="lastChange" Type="Date" DateFormat="M/d hh:mmtt" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column runat="server" Text="Company" DataIndex="company" Flex="1" />
<ext:Column runat="server" Text="Price" DataIndex="price">
</ext:Column>
<ext:Column runat="server" Text="Change" DataIndex="change">
</ext:Column>
<ext:Column runat="server" Text="Change" DataIndex="pctChange">
</ext:Column>
<ext:DateColumn runat="server" Text="Last Updated" DataIndex="lastChange" />
</Columns>
</ColumnModel>
<View>
<ext:GridView ID="GridView1" runat="server">
<GetRowClass Fn="getRowClass" />
</ext:GridView>
</View>
<SelectionModel>
<ext:RowSelectionModel runat="server" />
</SelectionModel>
</ext:GridPanel>
</body>
</html>