this.record.set in component column

  1. #1

    this.record.set in component column

    i am trying to set row store property in component column like below,

     <ext:ComponentColumn Editor="True" runat="server" Text="Alacak Hesap No" Hidden="True" Flex="2" DataIndex="AlacakHesapNo">
                                                    <Component>
                                                        <ext:ComboBox runat="server" MinChars="4" PageSize="10" StoreID="strMuhasebeKodu"
                                                            MaskRe="/[0-9\.]/" ID="ComboBox1" MatchFieldWidth="False" DisplayField="Kod" EmptyText="En az 4 karakter giriniz.">
    
                                                            <ListConfig Width="400" Height="400" ItemSelector=".x-boundlist-item">
                                                                <Tpl runat="server">
                                                                    <Html>
                                                                        <tpl for=".">
                                                                        <tpl if="[xindex] == 1">
                                                                            <table class="cbStates-list">
                                                                                <tr>
                                                                                    <th>Kod</th>
                                                                                    <th>Açıklama</th>
                                                                                </tr>
                                                                        </tpl>
                                                                        <tr class="x-boundlist-item">
                                                                            <td>{Kod}</td>
                                                                            <td>{Aciklama}</td>
                                                                        </tr>
                                                                        <tpl if="[xcount-xindex]==0">
                                                                            </table>
                                                                        </tpl>
                                                                    </tpl>
                                                                    </Html>
                                                                </Tpl>
                                                            </ListConfig>
                                                            <Listeners>
                                                                <Change Handler="if(this.getValue()!=null) { if(this.getValue().length>=4) { App.direct.GetMuhasebe( this.getValue());} }"></Change>
                                                                <Select Handler="
                                                                    App.direct.GetMuhasebeNoKdv(this.getValue(), {
                                                                    success: function (result) {
                                                                    this.record.set('TaxRatio',18);
                                                                     },
                                                                    failure: function (x) {
                                                                    Hata(x);
                                                                     }
                                                                    });
                                                                    ">
                                                                </Select>
                                                            </Listeners>
                                                        </ext:ComboBox>
                                                    </Component>
                                                </ext:ComponentColumn>
    but is gives an error that record is undefined. i cant understand why. How can i do this?
  2. #2
    At line 33 of the previous post, you call this.record, but if you take a look on this instance, it's the event, not the grid, so, the record is undefined.

    Please take a look on lines 10 to 17 and let me know if you need further assistance.

    <!DOCTYPE html>
    <html>
    <head runat="server">
        <script type="text/javascript">
            var updateRecord = function () {
                Ext.net.DirectMethod.request({
                    url: Ext.net.ResourceMgr.resolveUrl("~/Example/SomeAction"),
                    cleanRequest: true,
                    success: function (result) {
                        var record = App._grd.store.getById(0);
    
                        record.beginEdit();
    
                        record.set("Name", "Ext.NET");
    
                        record.endEdit();
                        record.commit();
                    }
                });
            }
        </script>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:GridPanel ID="_grd" Title="Ext.Net" Border="true" Width="500" Height="500" runat="server">
            <Store>
                <ext:Store AutoLoad="true" runat="server">
                    <Proxy>
                        <ext:AjaxProxy Url="~/Example/LoadFakeRecords/">
                            <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" />
                            </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" />
                </Columns>
            </ColumnModel>
            <Buttons>
                <ext:Button Text="Update Record" runat="server">
                    <Listeners>
                        <Click Handler="updateRecord();" />
                    </Listeners>
                </ext:Button>
            </Buttons>
        </ext:GridPanel>
    </body>
    </html>
    namespace SandBox.Controllers
    {
        public class ExampleController : System.Web.Mvc.Controller
        {
            public ActionResult Index() => View();
    
            public ActionResult SomeAction() => new AjaxResult
            {
                Success = true
            };
    
            public StoreResult LoadFakeRecords()
            {
                List<Entity> lst = new List<Entity>();
    
                for (int index = 0; index < 15; index++)
                {
                    lst.Add(new Entity
                    {
                        ID = index,
                        Name = $"Name - {index}"
                    });
                }
    
                return new StoreResult(lst, lst.Count());
            }
        }
    
        public class Entity
        {
            public int ID { get; set; }
    
            public string Name { get; set; }
        }
    }

Similar Threads

  1. [CLOSED] component column
    By sharmav1 in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 16, 2016, 2:48 AM
  2. Replies: 2
    Last Post: Aug 21, 2014, 8:55 AM
  3. Replies: 5
    Last Post: Aug 08, 2014, 8:18 AM
  4. Replies: 2
    Last Post: Jun 27, 2013, 10:18 PM
  5. [CLOSED] Over editor combobox component record gets undefined
    By bayoglu in forum 2.x Legacy Premium Help
    Replies: 8
    Last Post: May 06, 2013, 4:31 PM

Posting Permissions