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

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

Expand Messages
  • balaragunath
    Jan 3, 2008
    • 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!
      > >
      >
    • Show all 6 messages in this topic