getCellText only callable with column label not with column-index

RESOLVED DUPLICATE of bug 121568

Status

()

Core
XUL
--
enhancement
RESOLVED DUPLICATE of bug 121568
15 years ago
10 years ago

People

(Reporter: Roland Penning, Assigned: janv)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3a) Gecko/20021212
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3a) Gecko/20021212

To fill a custom treeview the function getCellText has to be called, it would be
handy if the cell could be approached with a columm-index. A treerow could then
be easier filled with a multidimensional array.
Current method:
treeView = ({
  rowCount : tablearray.length,
  getCellText : function(row, col) { return getRowCellData(row,col); }
});

function getRowCellData(row,col) {
  switch (col) {
    case "isbn"  : cell = 0;
                   break;
    case "author": cell = 1;
                   break;
    case "title" : cell = 2;
                   break;
    case "price" : cell = 3;
                   break;
  }
  return tablearray[row][cell];
}

Easier would be:
treeView = ({
  rowCount : tablearray.length,
  getCellText : function(row, col) { return tablearray[row][column-index]; }
});


Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Um... JS supports multidimensional arrays indexed by strings.  So you could do
tablearray[row][cell] indexed by string.

Alternately, you could name your columns '0', '1', etc...

Just thoughts.
(Assignee)

Comment 2

15 years ago
this is actually bug 121568

*** This bug has been marked as a duplicate of 121568 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → DUPLICATE

Updated

10 years ago
Component: XP Toolkit/Widgets: Trees → XUL
QA Contact: shrir → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.