Closed Bug 242010 Opened 20 years ago Closed 20 years ago

xul tree getCellText() broken in firefox

Categories

(Core :: XUL, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: pch, Assigned: janv)

References

Details

Attachments

(1 file)

1.91 KB, application/vnd.mozilla.xul+xml
Details
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a) Gecko/20040418 Firefox/0.8.0+
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a) Gecko/20040418 Firefox/0.8.0+

trying to get a cell's text from a xul treeview in firefox fails. the message is:

Error: uncaught exception: [Exception... "Could not convert JavaScript argument
arg 1 [nsITreeView.getCellText]"  nsresult: "0x80570009
(NS_ERROR_XPC_BAD_CONVERT_JS)"  location: "JS frame ::
http://localhost/files/lizard/xul.xul :: usertable_select :: line 37"  data: no]

Reproducible: Always
Steps to Reproduce:
1. load attached document
2. select a row

Actual Results:  
error alert pops up in firefox

Expected Results:  
like mozilla-1.6, get the seleceted text
Attached file xul tree view
selecting a row triggers function usertable_select(), getCellText() fails
Bug 221619 recently changed the interface for getCellText, it now takes a column
as the second argument rather than a string, see:

http://lxr.mozilla.org/mozilla/source/layout/xul/base/src/tree/public/nsITreeView.idl#155

Changing your code to something like this should work with both the old and the
new interfaces:

    var col = tree.columns ? tree.columns["id"] : "id";
    curSel = tree.view.getCellText (tree.currentIndex, col);

p.s. I don't know much beyond the basics of XUL so there may be a better way,
but this seems to work OK.
I see, the xul API in recent firefox builds is incompatible with the documented
version 1.0 one. Before submitting the bug, I searched _all_ of their summaries
for "getcelltext" with no meaningful hit; so this bug may at least serve to
document that change.

I also see, that there is a new property on the tree widget that can be used, by
the usual methods of object detection, to write code that supports both the 1.0
API and the forthcoming one.
I'm not sure which resolution to use to close this bug (assuming it should be),
José what do you think?
Uff, no clue, since bug 221619 will be available in 1.8a, meaning that Firefox
1.0 will not have this fix.
I still get the error using todays trunk build on Windows XP.
Assignee: firefox → jan
Component: General → XP Toolkit/Widgets: Trees
OS: Linux → All
Product: Firefox → Core
Version: unspecified → Trunk
(In reply to comment #6)
> I still get the error using todays trunk build on Windows XP.

Do you mean with the testcase? That testcase is still using the old interface so
it should error on trunk builds (which use the newer interface) but work on
Aviary which I think used the older interface. Or have I misunderstood?
Ah ok, that makes sense, then this bug should be marked as WFM, right?
(In reply to comment #8)
> Ah ok, that makes sense, then this bug should be marked as WFM, right?

->WORKSFORME
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → WORKSFORME
*** Bug 296483 has been marked as a duplicate of this bug. ***
*** Bug 296917 has been marked as a duplicate of this bug. ***
Component: XP Toolkit/Widgets: Trees → XUL
QA Contact: xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: