[CLOSED] Renderer doesn't fire

  1. #1

    [CLOSED] Renderer doesn't fire

    hi,

    I don't know what I am doing wrong. The rende method doesn't fire. I want to disable the the editor for one of the cells based on data in the other cell

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.stEvaluationData.DataSource = new object[]
                {
                    new object[] { "Base", 1, 1, 0,1 },
                    new object[] { "TTC", 1, 1, 1 ,1}
                };
                this.stEvaluationData.DataBind();
            }
        }
    </script>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Prepare Toolbar - Ext.NET Examples</title>
        <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript">
            var renderer = function (value,meta,record) {
                alert("hello");
                
                if (record.data.CompType=="Base") {
                    //disable the edtor.
                }
            };
        </script>
    </head>
    <body>
    <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:Store ID="stEvaluationData" runat="server">
            <Reader>
                <ext:ArrayReader>
                    <Fields>
                        <ext:RecordField Name="CompType" />
                        <ext:RecordField Name="Twentyfifth" />
                        <ext:RecordField Name="Fiftieth" />
                        <ext:RecordField Name="Sixtieth" />
                        <ext:RecordField Name="Seventyfifth" />
                    </Fields>
                </ext:ArrayReader>
            </Reader>
        </ext:Store>
        
        <ext:Window ID="winAddCountry" runat="server" Icon="ApplicationAdd" Modal="true" Width="525" Height="300">
            <Items>
                <ext:GridPanel ID="grEvaData" Title="Range Spread" runat="server" StoreID="stEvaluationData" Height="250">
                    <Plugins>
                        <ext:EditableGrid ID="EditableGrid1" runat="server" />
                    </Plugins>
                    <ColumnModel ID="ColumnModel1" runat="server">
                        <Columns>
                            <ext:Column DataIndex="CompType" Header="Comp Type" />
                            <ext:NumberColumn DataIndex="Twentyfifth" Header="25th">
                                <Editor>
                                    <ext:NumberField ID="NumberField1" runat="server" />
                                </Editor>
                            </ext:NumberColumn>
                            <ext:NumberColumn DataIndex="Fiftieth" Header="50th"/>
                            <ext:NumberColumn DataIndex="Sixtieth" Header="60th">
                                <Renderer Fn="renderer" />
                                <Editor>
                                    <ext:NumberField ID="NumberField2" runat="server" />
                                </Editor>
                            </ext:NumberColumn>
                            <ext:NumberColumn DataIndex="Seventyfifth" Header="75th" >
                                <Editor>
                                    <ext:NumberField ID="NumberField3" runat="server" />
                                </Editor>
                            </ext:NumberColumn>
                        </Columns>
                    </ColumnModel>
                </ext:GridPanel>
            </Items>
            <BottomBar>
                <ext:Toolbar ID="btEvalData" runat="server">
                    <Items>
                        <ext:ToolbarFill />
                        <ext:Button ID="btnSaveEvaData" runat="server" Text="Save" Icon="Disk" />
                    </Items>
                </ext:Toolbar>
            </BottomBar>
        </ext:Window>
    </form>
    </body>
    </html>
  2. #2

    RE: [CLOSED] Renderer doesn't fire

    Hi,

    Spezialized columns (like boolean, number, template and etc) doesn't support custom renderer (custom renderer is ignored by those columns)

    You cannot disable editor in the renderer because one editor instance uses for all column's cells

    You have to handle BeforeEdit event of the grid and return false to prevent editing of the particular cell
    beforeedit : ( <code style="font-style: normal; font-weight: normal; font-family: 'Lucida Console','Courier New',Courier,monospace; font-size: 12px;">Object e</code> )<div class="mdesc" style="margin: 0px; padding: 5px 0px; color: rgb(68, 68, 68);"><div class="long" style="margin: 0px; padding: 0px; display: block; line-height: 18px;">Fires before cell editing is triggered. The edit event object has the following properties
    <ul style="margin: 0px; padding: 5px 5px 5px 16px; list-style-type: none;"><li style="margin: 0px; padding: 0px;">grid - This grid<li style="margin: 0px; padding: 0px;">record - The record being edited<li style="margin: 0px; padding: 0px;">field - The field name being edited<li style="margin: 0px; padding: 0px;">value - The value for the field being edited.<li style="margin: 0px; padding: 0px;">row - The grid row index<li style="margin: 0px; padding: 0px;">column - The grid column index<li style="margin: 0px; padding: 0px;">cancel - Set this to true to cancel the edit or return false from your handler.[/list]<div class="mdetail-params" style="margin: 10px 0px 0px; padding: 0px 0px 0px 12px; font-size: 12px;"><strong style="font-style: normal; font-weight: normal; display: block; margin-bottom: 3px; font-size: 11px; color: rgb(85, 85, 85);">Listeners will be called with the following arguments:[/b]<ul style="margin: 12px; padding: 0px; list-style-type: circle; list-style-position: inside;"><li style="margin: 0px; padding: 0px; list-style-position: inside; list-style-type: circle;"><code style="font-style: normal; font-weight: normal; font-family: 'Lucida Console','Courier New',Courier,monospace; font-size: 12px;">e</code> : Object<div class="sub-desc" style="margin: 5px 5px 5px 16px; padding: 0px;">An edit event (see above for description)[/list]



Similar Threads

  1. SortChange Direct Event doesn't fire at all
    By cicaglisa in forum 1.x Help
    Replies: 1
    Last Post: May 23, 2012, 5:31 PM
  2. Save store doesn't fire CommitFailed event
    By Greg44 in forum 1.x Help
    Replies: 1
    Last Post: Apr 13, 2012, 4:15 PM
  3. GridPanel Renderer doesn' work
    By AlexMaslakov in forum 1.x Help
    Replies: 2
    Last Post: Aug 25, 2011, 12:46 PM
  4. [CLOSED] Change event on combobox doesn't fire
    By Stefanaccio in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 06, 2010, 5:01 PM
  5. Form validation doesn't fire
    By caha76 in forum 1.x Help
    Replies: 0
    Last Post: May 04, 2010, 12:15 PM

Posting Permissions