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

Re: get cell value of selected row in datatable. Help plzzzzzzzzzzzzzz!!!

Expand Messages
  • manhtuanquan78
    OHHHH. I have done it successful :D. Thank all. HAPPY NEW YEAR EVERYBODY.
    Message 1 of 6 , Jan 1, 2008
    View Source
    • 0 Attachment
      OHHHH. I have done it successful :D. Thank all.
      HAPPY NEW YEAR EVERYBODY.

      --- In ydn-javascript@yahoogroups.com, "manhtuanquan78"
      <manhtuanquan78@...> wrote:
      >
      > Hi All.
      > I want to setup a method:
      > function getCellValueOfSelectedRow(colName){
      > //TODO : how to do it???
      >
      > return cellValue
      > }
      >
      > In that:
      > -@parameter is: - colName: column Name
      > - purpose of method: get value of cell in seleted row with column name
      > For example: I have a datatable:
      > COL1 | COL2 | COL3
      > ---------------------
      > aaa | bbb | ccc
      > ddd | eee | fff
      > ggg | hhh | kkk
      >
      > ( only second row is selected)
      > If i call method: getCellValueOfSelectedRow("COL3") -> It will return
      > "fff"
      >
      > How to setup this method??? Please help me. THank you!
      >
    • manhtuanquan78
      //and code: function getValueCellOfSelectedRow(colName){ var i, j, k, l, aRecords; var oPaginator = this.myDataTable.updatePaginator(); // Paginator is
      Message 2 of 6 , Jan 2, 2008
      View Source
      • 0 Attachment
        //and code:
        function getValueCellOfSelectedRow(colName){
        var i, j, k, l, aRecords;
        var oPaginator = this.myDataTable.updatePaginator();

        // Paginator is enabled, show a subset of Records and update
        Paginator UI
        if(this.myDataTable.get("paginated")) {
        var rowsPerPage = oPaginator.rowsPerPage;
        var startRecordIndex = (oPaginator.currentPage - 1) *
        rowsPerPage;
        aRecords = this._oRecordSet.getRecords(startRecordIndex,
        rowsPerPage);
        this.formatPaginators();
        }
        // Show all records
        else {
        aRecords = this.myDataTable._oRecordSet.getRecords();
        }

        var elTbody = this.myDataTable._elTbody;
        var elRows = elTbody.rows;

        if(YAHOO.lang.isArray(aRecords) && (aRecords.length > 0)) {
        ///this.myDataTable.hideTableMessage();

        // Keep track of selected rows
        var indexRow = this.myDataTable.getSelectedRows();

        if(indexRow != null && indexRow != ""){
        elRow = this.myDataTable.getTrEl(parseInt(indexRow));

        //Kiem tra tat ca cac cot neu trung ten voi colName thi
        lay gia tri
        var keyIndex = 0;
        for(i=0; i<this.myDataTable._oColumnSet.keys.length; i++) {
        oColumn = this.myDataTable._oColumnSet.keys[i];
        var colKey = oColumn.getKey();

        if(colKey == colName){
        keyIndex = i;
        }//end if(colKey == colName)
        }//end for(i=0...

        var valCell = elRow.cells[keyIndex].innerHTML;
        alert(valCell);
        }//end if(indexRow != null)
        else{
        alert("No row is selected");
        }
        }//end if(YAHOO.lang.isArray(aRecords

        }

        --- In ydn-javascript@yahoogroups.com, "manhtuanquan78"
        <manhtuanquan78@...> wrote:
        >
        > Hi All.
        > I want to setup a method:
        > function getCellValueOfSelectedRow(colName){
        > //TODO : how to do it???
        >
        > return cellValue
        > }
        >
        > In that:
        > -@parameter is: - colName: column Name
        > - purpose of method: get value of cell in seleted row with column name
        > For example: I have a datatable:
        > COL1 | COL2 | COL3
        > ---------------------
        > aaa | bbb | ccc
        > ddd | eee | fff
        > ggg | hhh | kkk
        >
        > ( only second row is selected)
        > If i call method: getCellValueOfSelectedRow("COL3") -> It will return
        > "fff"
        >
        > How to setup this method??? Please help me. THank you!
        >
      • balaragunath
        Hi, How can i trigger the same function getValueCellOfSelectedRow on the select of the row in datatable?? ... column name
        Message 3 of 6 , Jan 3, 2008
        View Source
        • 0 Attachment
          Hi,

          How can i trigger the same function 'getValueCellOfSelectedRow' on the
          select of the row in datatable??

          --- In ydn-javascript@yahoogroups.com, "manhtuanquan78"
          <manhtuanquan78@...> wrote:
          >
          > //and code:
          > function getValueCellOfSelectedRow(colName){
          > var i, j, k, l, aRecords;
          > var oPaginator = this.myDataTable.updatePaginator();
          >
          > // Paginator is enabled, show a subset of Records and update
          > Paginator UI
          > if(this.myDataTable.get("paginated")) {
          > var rowsPerPage = oPaginator.rowsPerPage;
          > var startRecordIndex = (oPaginator.currentPage - 1) *
          > rowsPerPage;
          > aRecords = this._oRecordSet.getRecords(startRecordIndex,
          > rowsPerPage);
          > this.formatPaginators();
          > }
          > // Show all records
          > else {
          > aRecords = this.myDataTable._oRecordSet.getRecords();
          > }
          >
          > var elTbody = this.myDataTable._elTbody;
          > var elRows = elTbody.rows;
          >
          > if(YAHOO.lang.isArray(aRecords) && (aRecords.length > 0)) {
          > ///this.myDataTable.hideTableMessage();
          >
          > // Keep track of selected rows
          > var indexRow = this.myDataTable.getSelectedRows();
          >
          > if(indexRow != null && indexRow != ""){
          > elRow = this.myDataTable.getTrEl(parseInt(indexRow));
          >
          > //Kiem tra tat ca cac cot neu trung ten voi colName thi
          > lay gia tri
          > var keyIndex = 0;
          > for(i=0; i<this.myDataTable._oColumnSet.keys.length; i++) {
          > oColumn = this.myDataTable._oColumnSet.keys[i];
          > var colKey = oColumn.getKey();
          >
          > if(colKey == colName){
          > keyIndex = i;
          > }//end if(colKey == colName)
          > }//end for(i=0...
          >
          > var valCell = elRow.cells[keyIndex].innerHTML;
          > alert(valCell);
          > }//end if(indexRow != null)
          > else{
          > alert("No row is selected");
          > }
          > }//end if(YAHOO.lang.isArray(aRecords
          >
          > }
          >
          > --- In ydn-javascript@yahoogroups.com, "manhtuanquan78"
          > <manhtuanquan78@> wrote:
          > >
          > > Hi All.
          > > I want to setup a method:
          > > function getCellValueOfSelectedRow(colName){
          > > //TODO : how to do it???
          > >
          > > return cellValue
          > > }
          > >
          > > In that:
          > > -@parameter is: - colName: column Name
          > > - purpose of method: get value of cell in seleted row with
          column name
          > > For example: I have a datatable:
          > > COL1 | COL2 | COL3
          > > ---------------------
          > > aaa | bbb | ccc
          > > ddd | eee | fff
          > > ggg | hhh | kkk
          > >
          > > ( only second row is selected)
          > > If i call method: getCellValueOfSelectedRow("COL3") -> It will return
          > > "fff"
          > >
          > > How to setup this method??? Please help me. THank you!
          > >
          >
        • Satyam
          You can listen to rowSelectEvent: http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#rowSelectEvent To read the value of any field within the row
          Message 4 of 6 , Jan 4, 2008
          View Source
          • 0 Attachment
            You can listen to rowSelectEvent:

            http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#rowSelectEvent

            To read the value of any field within the row you just need to do something
            like this:

            myDataTable.subscribe('rowSelectEvent',function (oArgs) {
            alert(oArgs.record.getData('fieldName'));
            });

            Satyam

            ----- Original Message -----
            From: "balaragunath" <balaragunath@...>
            To: <ydn-javascript@yahoogroups.com>
            Sent: Friday, January 04, 2008 5:54 AM
            Subject: [ydn-javascript] Re: get cell value of selected row in datatable.
            Help plzzzzzzzzzzzzzz!!!


            > Hi,
            >
            > How can i trigger the same function 'getValueCellOfSelectedRow' on the
            > select of the row in datatable??
            >
            > --- In ydn-javascript@yahoogroups.com, "manhtuanquan78"
            > <manhtuanquan78@...> wrote:
            >>
            >> //and code:
            >> function getValueCellOfSelectedRow(colName){
            >> var i, j, k, l, aRecords;
            >> var oPaginator = this.myDataTable.updatePaginator();
            >>
            >> // Paginator is enabled, show a subset of Records and update
            >> Paginator UI
            >> if(this.myDataTable.get("paginated")) {
            >> var rowsPerPage = oPaginator.rowsPerPage;
            >> var startRecordIndex = (oPaginator.currentPage - 1) *
            >> rowsPerPage;
            >> aRecords = this._oRecordSet.getRecords(startRecordIndex,
            >> rowsPerPage);
            >> this.formatPaginators();
            >> }
            >> // Show all records
            >> else {
            >> aRecords = this.myDataTable._oRecordSet.getRecords();
            >> }
            >>
            >> var elTbody = this.myDataTable._elTbody;
            >> var elRows = elTbody.rows;
            >>
            >> if(YAHOO.lang.isArray(aRecords) && (aRecords.length > 0)) {
            >> ///this.myDataTable.hideTableMessage();
            >>
            >> // Keep track of selected rows
            >> var indexRow = this.myDataTable.getSelectedRows();
            >>
            >> if(indexRow != null && indexRow != ""){
            >> elRow = this.myDataTable.getTrEl(parseInt(indexRow));
            >>
            >> //Kiem tra tat ca cac cot neu trung ten voi colName thi
            >> lay gia tri
            >> var keyIndex = 0;
            >> for(i=0; i<this.myDataTable._oColumnSet.keys.length; i++) {
            >> oColumn = this.myDataTable._oColumnSet.keys[i];
            >> var colKey = oColumn.getKey();
            >>
            >> if(colKey == colName){
            >> keyIndex = i;
            >> }//end if(colKey == colName)
            >> }//end for(i=0...
            >>
            >> var valCell = elRow.cells[keyIndex].innerHTML;
            >> alert(valCell);
            >> }//end if(indexRow != null)
            >> else{
            >> alert("No row is selected");
            >> }
            >> }//end if(YAHOO.lang.isArray(aRecords
            >>
            >> }
            >>
            >> --- In ydn-javascript@yahoogroups.com, "manhtuanquan78"
            >> <manhtuanquan78@> wrote:
            >> >
            >> > Hi All.
            >> > I want to setup a method:
            >> > function getCellValueOfSelectedRow(colName){
            >> > //TODO : how to do it???
            >> >
            >> > return cellValue
            >> > }
            >> >
            >> > In that:
            >> > -@parameter is: - colName: column Name
            >> > - purpose of method: get value of cell in seleted row with
            > column name
            >> > For example: I have a datatable:
            >> > COL1 | COL2 | COL3
            >> > ---------------------
            >> > aaa | bbb | ccc
            >> > ddd | eee | fff
            >> > ggg | hhh | kkk
            >> >
            >> > ( only second row is selected)
            >> > If i call method: getCellValueOfSelectedRow("COL3") -> It will return
            >> > "fff"
            >> >
            >> > How to setup this method??? Please help me. THank you!
            >> >
            >>
            >
            >
            >
            >
            >
            > Yahoo! Groups Links
            >
            >
            >
            >
            >
            > --
            > No virus found in this incoming message.
            > Checked by AVG Free Edition.
            > Version: 7.5.516 / Virus Database: 269.17.13/1207 - Release Date:
            > 02/01/2008 11:29
            >
            >
          • manhtuanquan78
            Thank Satyam so much! Can i ask other problem: How I can come back page which have selected row on datatable ( Datatable is paginated ) For example: I have a
            Message 5 of 6 , Jan 7, 2008
            View Source
            • 0 Attachment
              Thank Satyam so much!

              Can i ask other problem: How I can come back page which have selected
              row on datatable ( Datatable is paginated )

              For example: I have a Datatable with 100 records. And its
              splited 5 pages (20 records per page). This is my description below

              Step1: I select one row (at any page) on datatable
              Step2: I click other page ( I don't select any row )
              Step3: I click button (that is outside datatable)
              I want that when i click button. It will come back page which have
              selected row.

              How to setup method on button?

              Thank you!
            Your message has been successfully submitted and would be delivered to recipients shortly.