[CLOSED] grid panel - exception on delete row

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] grid panel - exception on delete row

    In my gridrow I have ImageCommand and when click I need to delete row. My code is:

    On click that part of code is ok, but after that I got exception:

    Microsoft JScript runtime error: Unable to get value of the property 'parentNode': object is null or undefined

    Can you help me with this, please?

    NOTE: Marking as closed. Please feel free to update the thread with a sample to reproduce the problem.
    Last edited by Daniil; Nov 02, 2011 at 5:08 PM. Reason: Marked as [CLOSED]. No requested info was provided.
  2. #2

    I was unable to reproduce the problem. Please provide your test case.


    <%@ 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 = new object[] 
                    new object[] { "test1", "test2", "test3" },
                    new object[] { "test4", "test5", "test6" },
                    new object[] { "test7", "test8", "test9" },
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
                    <ext:Store ID="Store1" runat="server">
                                    <ext:RecordField Name="test1" />
                                    <ext:RecordField Name="test2" />
                                    <ext:RecordField Name="test3" />
                <ColumnModel runat="server">
                        <ext:Column Header="Test1" DataIndex="test1" />
                        <ext:Column Header="Test2" DataIndex="test2" />
                        <ext:Column Header="Test3" DataIndex="test3" />
                                <ext:ImageCommand CommandName="delete" Icon="Delete" />
                    <Command Handler="var store = this.getStore();
                                      this.getView().refresh();" />
  3. #3
    All code is too complicated to post here ...

    This is my store:

                                    <ext:Store ID="Store1" runat="server">
                                            <ext:JsonReader IDProperty="TR_ID">
                                                    <ext:RecordField Name="TR_ID" Type="Int"></ext:RecordField>
                                                    <ext:RecordField Name="Trasat" Type="Int"></ext:RecordField>
                                                    <ext:RecordField Name="Partija"></ext:RecordField>
                                                    <ext:RecordField Name="TR_Naziv"></ext:RecordField>
    when I Add new record to Store I do that in JS:

                function addToStore1() {
                    var myStore = #{Store1};
                    counter = counter - 1;
                    var tekuciRacun = { 
                        TR_ID: -1, 
                        Trasat: parseInt(#{TextFieldTrasat}.getValue()), 
                        Partija: getPartija10(#{TextFieldPartija}), 
                        TR_Naziv: #{TextFieldNazivRacuna_TR}.getValue() 
                    var storeRecord = new myStore.recordType(tekuciRacun, counter); // create new record
    And after that if user need to delete added record with TR_ID = -1 he click to delete and i call this function:
                function DeleteTR(command, record) { 
                    if (record.data.TR_ID == -1) {
    else { 
    (TR_ID is -1 is because user did not save record to database)
  4. #4
    Maybe some problem in TR_ID = -1? Because I put that is IDProperty in Store and for every new record tr_id is -1.
  5. #5
    Yes, there must be a unique id for every record.

    I guess the issue is not reproducible with a single new record, right?

    You could use the record's .isNew() method to check if record is a new one.
  6. #6
    No, probelm occurs when it is one single row.

    record.isNew() is 'undefined' for new record.

    in autogenerated code exception occurs here:

    var colIndex=this.grid.view.findCellIndex(target.parentNode.parentNode)

Similar Threads

  1. Ext.Net 2.0 Delete from Grid in C#
    By OSSAGHO in forum 2.x Help
    Replies: 0
    Last Post: Aug 08, 2012, 2:05 PM
  2. [CLOSED] Adding panels to a tab panel throws exception
    By RCM in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 09, 2012, 7:28 PM
  3. Replies: 4
    Last Post: Aug 09, 2010, 4:12 PM
  4. [CLOSED] Exception when grid contains no rows
    By alexp in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 18, 2009, 10:37 AM
  5. Problem with Delete Command and Grid Panel
    By jpmcm88 in forum 1.x Help
    Replies: 2
    Last Post: Jul 20, 2009, 2:02 PM

Tags for this Thread

Posting Permissions