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

Re: Datatable - unable to delete a row

Expand Messages
  • twocupcoffee
    What is the value of oRecordId? Is the ID returning correct? - Andrew Kou ... YAHOO.example.MultipleFeatures.filterPanel.myDataTable.getSelectedRows(); ...
    Message 1 of 7 , Jan 31, 2008
    View Source
    • 0 Attachment
      What is the value of oRecordId?

      Is the ID returning correct?

      - Andrew Kou

      --- In ydn-javascript@yahoogroups.com, John Comerford <johnc@...> wrote:
      >
      > Thanks for then reply Andrew,
      >
      > I have changed my code to the following:
      >
      > var oRecordId =
      >
      YAHOO.example.MultipleFeatures.filterPanel.myDataTable.getSelectedRows();
      > var oRecord =
      >
      YAHOO.example.MultipleFeatures.filterPanel.myDataTable.getRecordSet().getRecord(oRecordId);
      > alert(oRecord);
      >
      >
      YAHOO.example.MultipleFeatures.filterPanel.myDataTable.deleteRow(oRecord);
      >
      > the 'alert(oRecord)' command returns null and the row is still not
      > deleted any ideas where I am going astray ?
      >
      > TIA,
      > John
      >
      >
      > twocupcoffee wrote:
      > >
      > > Hi John,
      > >
      > > getSelectedRows() returns an array of record IDs, and the deleteRow
      > > function takes a record from the datatable. So you're actually almost
      > > there, you just need to retrieve the record using the record ID and
      > > then pass the record to deleteRow
      > >
      > > - Andrew Kou
      > >
      > > --- In ydn-javascript@yahoogroups.com
      > > <mailto:ydn-javascript%40yahoogroups.com>, John Comerford <johnc@>
      > > wrote:
      > > >
      > > > Hi Folks,
      > > >
      > > > I am trying to delete the selected row when the user clicks a
      button.
      > > >
      > > > I have one main datatable with 250 records, and when the users
      clicks a
      > > > button I open a Dialog with a second datatable. It is the second
      > > > datatable I want to delete the row from. I use getSelectedRows() to
      > > get
      > > > the record Id of the selected row. This returns 252 and then I use
      > > > deleteRow(oRecord) to try and delete the row, but it doesn't do
      > > anything.
      > > >
      > > > 1) Is getSelectedRows() returning 252 correct ? I am thinking
      that the
      > > > record ID's are uniques across both datatables so the 252 is the
      250 +
      > > > in table a with the first selected row in table b.
      > > >
      > > > 2) Do I need to do something with the record id to convert it to
      a row
      > > > number ? deleteRow(252) does nothing, but if I deleteRow(0) it
      deletes
      > > > the first row ?
      > > >
      > > >
      > > > My delete code is as follows:
      > > >
      > > > this.filterRemove = function () {
      > > > var oRecord =
      > > >
      > >
      YAHOO.example.MultipleFeatures.filterPanel.myDataTable.getSelectedRows();
      > > > alert(oRecord);
      > > >
      > > >
      > >
      YAHOO.example.MultipleFeatures.filterPanel.myDataTable.deleteRow(oRecord);
      > > > } // this.filterRemove = function () {
      > > >
      > > >
      > > >
      > > > TIA,
      > > > John
      > > >
      > >
      > >
      >
    • Satyam
      I think you are still missing an important think that Andrew pointed out, getSelectedRows (plural) returns an array, even if it only contains one element. ...
      Message 2 of 7 , Jan 31, 2008
      View Source
      • 0 Attachment
        I think you are still missing an important think that Andrew pointed out,
        getSelectedRows (plural) returns an array, even if it only contains one
        element.

        ----- Original Message -----
        From: "John Comerford" <johnc@...>
        To: <ydn-javascript@yahoogroups.com>
        Sent: Friday, February 01, 2008 5:56 AM
        Subject: Re: [ydn-javascript] Re: Datatable - unable to delete a row


        > Thanks for then reply Andrew,
        >
        > I have changed my code to the following:
        >
        > var oRecordId =
        > YAHOO.example.MultipleFeatures.filterPanel.myDataTable.getSelectedRows();
        > var oRecord =
        > YAHOO.example.MultipleFeatures.filterPanel.myDataTable.getRecordSet().getRecord(oRecordId);
        > alert(oRecord);
        >
        > YAHOO.example.MultipleFeatures.filterPanel.myDataTable.deleteRow(oRecord);
        >
        > the 'alert(oRecord)' command returns null and the row is still not
        > deleted any ideas where I am going astray ?
        >
        > TIA,
        > John
        >
        >
        > twocupcoffee wrote:
        >>
        >> Hi John,
        >>
        >> getSelectedRows() returns an array of record IDs, and the deleteRow
        >> function takes a record from the datatable. So you're actually almost
        >> there, you just need to retrieve the record using the record ID and
        >> then pass the record to deleteRow
        >>
        >> - Andrew Kou
        >>
        >> --- In ydn-javascript@yahoogroups.com
        >> <mailto:ydn-javascript%40yahoogroups.com>, John Comerford <johnc@...>
        >> wrote:
        >> >
        >> > Hi Folks,
        >> >
        >> > I am trying to delete the selected row when the user clicks a button.
        >> >
        >> > I have one main datatable with 250 records, and when the users clicks a
        >> > button I open a Dialog with a second datatable. It is the second
        >> > datatable I want to delete the row from. I use getSelectedRows() to
        >> get
        >> > the record Id of the selected row. This returns 252 and then I use
        >> > deleteRow(oRecord) to try and delete the row, but it doesn't do
        >> anything.
        >> >
        >> > 1) Is getSelectedRows() returning 252 correct ? I am thinking that the
        >> > record ID's are uniques across both datatables so the 252 is the 250 +
        >> > in table a with the first selected row in table b.
        >> >
        >> > 2) Do I need to do something with the record id to convert it to a row
        >> > number ? deleteRow(252) does nothing, but if I deleteRow(0) it deletes
        >> > the first row ?
        >> >
        >> >
        >> > My delete code is as follows:
        >> >
        >> > this.filterRemove = function () {
        >> > var oRecord =
        >> >
        >> YAHOO.example.MultipleFeatures.filterPanel.myDataTable.getSelectedRows();
        >> > alert(oRecord);
        >> >
        >> >
        >> YAHOO.example.MultipleFeatures.filterPanel.myDataTable.deleteRow(oRecord);
        >> > } // this.filterRemove = function () {
        >> >
        >> >
        >> >
        >> > TIA,
        >> > John
        >> >
        >>
        >>
        >
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        > --
        > No virus found in this incoming message.
        > Checked by AVG Free Edition.
        > Version: 7.5.516 / Virus Database: 269.19.17/1252 - Release Date:
        > 30/01/2008 20:51
        >
        >
      • twocupcoffee
        haha, thanks for pointing that out. I wanted him to figure it out =) That s why I asked the questions. - Andrew Kou ... out, ...
        Message 3 of 7 , Feb 1, 2008
        View Source
        • 0 Attachment
          haha, thanks for pointing that out. I wanted him to figure it out
          =)

          That's why I asked the questions.

          - Andrew Kou


          --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@...> wrote:
          >
          > I think you are still missing an important think that Andrew pointed
          out,
          > getSelectedRows (plural) returns an array, even if it only contains one
          > element.
          >
          > ----- Original Message -----
          > From: "John Comerford" <johnc@...>
          > To: <ydn-javascript@yahoogroups.com>
          > Sent: Friday, February 01, 2008 5:56 AM
          > Subject: Re: [ydn-javascript] Re: Datatable - unable to delete a row
          >
          >
          > > Thanks for then reply Andrew,
          > >
          > > I have changed my code to the following:
          > >
          > > var oRecordId =
          > >
          YAHOO.example.MultipleFeatures.filterPanel.myDataTable.getSelectedRows();
          > > var oRecord =
          > >
          YAHOO.example.MultipleFeatures.filterPanel.myDataTable.getRecordSet().getRecord(oRecordId);
          > > alert(oRecord);
          > >
          > >
          YAHOO.example.MultipleFeatures.filterPanel.myDataTable.deleteRow(oRecord);
          > >
          > > the 'alert(oRecord)' command returns null and the row is still not
          > > deleted any ideas where I am going astray ?
          > >
          > > TIA,
          > > John
          > >
          > >
          > > twocupcoffee wrote:
          > >>
          > >> Hi John,
          > >>
          > >> getSelectedRows() returns an array of record IDs, and the deleteRow
          > >> function takes a record from the datatable. So you're actually almost
          > >> there, you just need to retrieve the record using the record ID and
          > >> then pass the record to deleteRow
          > >>
          > >> - Andrew Kou
          > >>
          > >> --- In ydn-javascript@yahoogroups.com
          > >> <mailto:ydn-javascript%40yahoogroups.com>, John Comerford <johnc@>
          > >> wrote:
          > >> >
          > >> > Hi Folks,
          > >> >
          > >> > I am trying to delete the selected row when the user clicks a
          button.
          > >> >
          > >> > I have one main datatable with 250 records, and when the users
          clicks a
          > >> > button I open a Dialog with a second datatable. It is the second
          > >> > datatable I want to delete the row from. I use getSelectedRows() to
          > >> get
          > >> > the record Id of the selected row. This returns 252 and then I use
          > >> > deleteRow(oRecord) to try and delete the row, but it doesn't do
          > >> anything.
          > >> >
          > >> > 1) Is getSelectedRows() returning 252 correct ? I am thinking
          that the
          > >> > record ID's are uniques across both datatables so the 252 is
          the 250 +
          > >> > in table a with the first selected row in table b.
          > >> >
          > >> > 2) Do I need to do something with the record id to convert it
          to a row
          > >> > number ? deleteRow(252) does nothing, but if I deleteRow(0) it
          deletes
          > >> > the first row ?
          > >> >
          > >> >
          > >> > My delete code is as follows:
          > >> >
          > >> > this.filterRemove = function () {
          > >> > var oRecord =
          > >> >
          > >>
          YAHOO.example.MultipleFeatures.filterPanel.myDataTable.getSelectedRows();
          > >> > alert(oRecord);
          > >> >
          > >> >
          > >>
          YAHOO.example.MultipleFeatures.filterPanel.myDataTable.deleteRow(oRecord);
          > >> > } // this.filterRemove = function () {
          > >> >
          > >> >
          > >> >
          > >> > TIA,
          > >> > John
          > >> >
          > >>
          > >>
          > >
          > >
          > >
          > >
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          > >
          > > --
          > > No virus found in this incoming message.
          > > Checked by AVG Free Edition.
          > > Version: 7.5.516 / Virus Database: 269.19.17/1252 - Release Date:
          > > 30/01/2008 20:51
          > >
          > >
          >
        • John Comerford
          I thought since the array only had one element I d get away with it, but that s not the case. Once I referenced the individual elements it worked fine. Thanks
          Message 4 of 7 , Feb 3, 2008
          View Source
          • 0 Attachment
            I thought since the array only had one element I'd get away with it, but
            that's not the case. Once I referenced the individual elements it
            worked fine.

            Thanks for the help,
            John


            twocupcoffee wrote:
            >
            > haha, thanks for pointing that out. I wanted him to figure it out
            > =)
            >
            > That's why I asked the questions.
            >
            > - Andrew Kou
            >
            > --- In ydn-javascript@yahoogroups.com
            > <mailto:ydn-javascript%40yahoogroups.com>, "Satyam" <satyam@...> wrote:
            > >
            > > I think you are still missing an important think that Andrew pointed
            > out,
            > > getSelectedRows (plural) returns an array, even if it only contains one
            > > element.
            > >
            > > ----- Original Message -----
            > > From: "John Comerford" <johnc@...>
            > > To: <ydn-javascript@yahoogroups.com
            > <mailto:ydn-javascript%40yahoogroups.com>>
            > > Sent: Friday, February 01, 2008 5:56 AM
            > > Subject: Re: [ydn-javascript] Re: Datatable - unable to delete a row
            > >
            > >
            > > > Thanks for then reply Andrew,
            > > >
            > > > I have changed my code to the following:
            > > >
            > > > var oRecordId =
            > > >
            > YAHOO.example.MultipleFeatures.filterPanel.myDataTable.getSelectedRows();
            > > > var oRecord =
            > > >
            > YAHOO.example.MultipleFeatures.filterPanel.myDataTable.getRecordSet().getRecord(oRecordId);
            > > > alert(oRecord);
            > > >
            > > >
            > YAHOO.example.MultipleFeatures.filterPanel.myDataTable.deleteRow(oRecord);
            > > >
            > > > the 'alert(oRecord)' command returns null and the row is still not
            > > > deleted any ideas where I am going astray ?
            > > >
            > > > TIA,
            > > > John
            > > >
            > > >
            > > > twocupcoffee wrote:
            > > >>
            > > >> Hi John,
            > > >>
            > > >> getSelectedRows() returns an array of record IDs, and the deleteRow
            > > >> function takes a record from the datatable. So you're actually almost
            > > >> there, you just need to retrieve the record using the record ID and
            > > >> then pass the record to deleteRow
            > > >>
            > > >> - Andrew Kou
            > > >>
            > > >> --- In ydn-javascript@yahoogroups.com
            > <mailto:ydn-javascript%40yahoogroups.com>
            > > >> <mailto:ydn-javascript%40yahoogroups.com>, John Comerford <johnc@>
            > > >> wrote:
            > > >> >
            > > >> > Hi Folks,
            > > >> >
            > > >> > I am trying to delete the selected row when the user clicks a
            > button.
            > > >> >
            > > >> > I have one main datatable with 250 records, and when the users
            > clicks a
            > > >> > button I open a Dialog with a second datatable. It is the second
            > > >> > datatable I want to delete the row from. I use getSelectedRows() to
            > > >> get
            > > >> > the record Id of the selected row. This returns 252 and then I use
            > > >> > deleteRow(oRecord) to try and delete the row, but it doesn't do
            > > >> anything.
            > > >> >
            > > >> > 1) Is getSelectedRows() returning 252 correct ? I am thinking
            > that the
            > > >> > record ID's are uniques across both datatables so the 252 is
            > the 250 +
            > > >> > in table a with the first selected row in table b.
            > > >> >
            > > >> > 2) Do I need to do something with the record id to convert it
            > to a row
            > > >> > number ? deleteRow(252) does nothing, but if I deleteRow(0) it
            > deletes
            > > >> > the first row ?
            > > >> >
            > > >> >
            > > >> > My delete code is as follows:
            > > >> >
            > > >> > this.filterRemove = function () {
            > > >> > var oRecord =
            > > >> >
            > > >>
            > YAHOO.example.MultipleFeatures.filterPanel.myDataTable.getSelectedRows();
            > > >> > alert(oRecord);
            > > >> >
            > > >> >
            > > >>
            > YAHOO.example.MultipleFeatures.filterPanel.myDataTable.deleteRow(oRecord);
            > > >> > } // this.filterRemove = function () {
            > > >> >
            > > >> >
            > > >> >
            > > >> > TIA,
            > > >> > John
            > > >> >
            > > >>
            > > >>
            > > >
            > > >
            > > >
            > > >
            > > > Yahoo! Groups Links
            > > >
            > > >
            > > >
            > > >
            > > >
            > > > --
            > > > No virus found in this incoming message.
            > > > Checked by AVG Free Edition.
            > > > Version: 7.5.516 / Virus Database: 269.19.17/1252 - Release Date:
            > > > 30/01/2008 20:51
            > > >
            > > >
            > >
            >
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.