Loading ...
Sorry, an error occurred while loading the content.

Datatable deleteRows clone issue

Expand Messages
  • Mark
    I m in the process of upgrading to YUI 2.6 and I started having issues when deleting rows. I ve traced the problem to the clone method that is called when
    Message 1 of 5 , Oct 2, 2008
    View Source
    • 0 Attachment
      I'm in the process of upgrading to YUI 2.6 and I started having issues
      when deleting rows. I've traced the problem to the clone method that
      is called when rows are deleted from the recordset. I have attached
      YUI tooltips to some of my cells in my datatable and because of this
      the clone method goes into an infinite loop. What I'm really curious
      about though is why the clone method is needed at all. What is the
      reason for cloning the rows when we can just use the original objects?
      I don't see the difference here other than unnecessary overhead.
    • jennykhan
      Hi Mark, In general, we use _cloneObject() on object literals of data to preserve their state for later use (generally for firing Custom Events) while being
      Message 2 of 5 , Oct 22, 2008
      View Source
      • 0 Attachment
        Hi Mark,

        In general, we use _cloneObject() on object literals of data to
        preserve their state for later use (generally for firing Custom
        Events) while being able to update the underlying data. The underlying
        data is expected to be a known JS type, such as String, Number, Date,
        etc, but not something like a function or a widget instance. I'm not
        sure where you'd be getting the infinite loop, so posting a URL to the
        repro case would be helpful to debugging the problem.

        Regards,
        Jenny


        --- In ydn-javascript@yahoogroups.com, "Mark" <markcuk@...> wrote:
        >
        > I'm in the process of upgrading to YUI 2.6 and I started having
        issues
        > when deleting rows. I've traced the problem to the clone method that
        > is called when rows are deleted from the recordset. I have attached
        > YUI tooltips to some of my cells in my datatable and because of this
        > the clone method goes into an infinite loop. What I'm really curious
        > about though is why the clone method is needed at all. What is the
        > reason for cloning the rows when we can just use the original
        objects?
        > I don't see the difference here other than unnecessary overhead.
        >
      • Mr. Derrick R Burns
        The problem with infinite loops is that clone does not detect circular references. To fix this, the clone routine needs to be modified to maintain a list of
        Message 3 of 5 , Oct 22, 2008
        View Source
        • 0 Attachment
          The problem with infinite loops is that clone does not detect circular references. To fix this, the clone routine needs to be modified to maintain a list of objects and their clones, and not to recurse to clone objects that are already in the list.

          Derrick
        • Mark Curtis
          Hi Jenny, I don t have a URL to the application because my development is all internal right now, but basically what I m doing is creating a tooltip widget in
          Message 4 of 5 , Oct 23, 2008
          View Source
          • 0 Attachment
            Hi Jenny,

            I don't have a URL to the application because my development is all internal right now, but basically what I'm doing is creating a tooltip widget in my custom formatter and appending that tooltip object to the oData object.  Because of this the clone method is trying to clone the tooltip widget along with the data and because of the circular references in tooltip it is causing an infinite loop.  The thing I'm actually confused about though is why the clone method needs to be called when rows are being deleted from the recordset.  I understand that it is used for creating copies of the data to use when doing things like firing custom events, but in the case of deleting rows why can't we just use the existing data objects instead of creating clones since they're not being used by anything else anymore?

            Thanks!
            -Mark

            On Wed, Oct 22, 2008 at 7:36 PM, jennykhan <jennyhan@...> wrote:

            Hi Mark,

            In general, we use _cloneObject() on object literals of data to
            preserve their state for later use (generally for firing Custom
            Events) while being able to update the underlying data. The underlying
            data is expected to be a known JS type, such as String, Number, Date,
            etc, but not something like a function or a widget instance. I'm not
            sure where you'd be getting the infinite loop, so posting a URL to the
            repro case would be helpful to debugging the problem.

            Regards,
            Jenny



            --- In ydn-javascript@yahoogroups.com, "Mark" <markcuk@...> wrote:
            >
            > I'm in the process of upgrading to YUI 2.6 and I started having
            issues
            > when deleting rows. I've traced the problem to the clone method that
            > is called when rows are deleted from the recordset. I have attached
            > YUI tooltips to some of my cells in my datatable and because of this
            > the clone method goes into an infinite loop. What I'm really curious
            > about though is why the clone method is needed at all. What is the
            > reason for cloning the rows when we can just use the original
            objects?
            > I don't see the difference here other than unnecessary overhead.
            >


          • jennykhan
            You re right -- it s an inefficiency that should be addressed in a future release. Please file a bug in SourceForge so it doesn t slip through the cracks.
            Message 5 of 5 , Dec 1, 2008
            View Source
            • 0 Attachment
              You're right -- it's an inefficiency that should be addressed in a
              future release. Please file a bug in SourceForge so it doesn't slip
              through the cracks.

              Thanks!
              Jenny



              --- In ydn-javascript@yahoogroups.com, "Mark Curtis" <markcuk@...>
              wrote:
              >
              > Hi Jenny,
              >
              > I don't have a URL to the application because my development is
              all internal
              > right now, but basically what I'm doing is creating a tooltip
              widget in my
              > custom formatter and appending that tooltip object to the oData
              object.
              > Because of this the clone method is trying to clone the tooltip
              widget along
              > with the data and because of the circular references in tooltip it
              is
              > causing an infinite loop. The thing I'm actually confused about
              though is
              > why the clone method needs to be called when rows are being
              deleted from the
              > recordset. I understand that it is used for creating copies of
              the data to
              > use when doing things like firing custom events, but in the case
              of deleting
              > rows why can't we just use the existing data objects instead of
              creating
              > clones since they're not being used by anything else anymore?
              >
              > Thanks!
              > -Mark
              >
              > On Wed, Oct 22, 2008 at 7:36 PM, jennykhan <jennyhan@...> wrote:
              >
              > > Hi Mark,
              > >
              > > In general, we use _cloneObject() on object literals of data to
              > > preserve their state for later use (generally for firing Custom
              > > Events) while being able to update the underlying data. The
              underlying
              > > data is expected to be a known JS type, such as String, Number,
              Date,
              > > etc, but not something like a function or a widget instance. I'm
              not
              > > sure where you'd be getting the infinite loop, so posting a URL
              to the
              > > repro case would be helpful to debugging the problem.
              > >
              > > Regards,
              > > Jenny
              > >
              > >
              > > --- In ydn-javascript@yahoogroups.com <ydn-javascript%
              40yahoogroups.com>,
              > > "Mark" <markcuk@> wrote:
              > > >
              > > > I'm in the process of upgrading to YUI 2.6 and I started having
              > > issues
              > > > when deleting rows. I've traced the problem to the clone
              method that
              > > > is called when rows are deleted from the recordset. I have
              attached
              > > > YUI tooltips to some of my cells in my datatable and because
              of this
              > > > the clone method goes into an infinite loop. What I'm really
              curious
              > > > about though is why the clone method is needed at all. What is
              the
              > > > reason for cloning the rows when we can just use the original
              > > objects?
              > > > I don't see the difference here other than unnecessary
              overhead.
              > > >
              > >
              > >
              > >
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.