Closed Bug 296917 Opened 20 years ago Closed 20 years ago

XUL : Conversion Exception in nsITreeView.getCellText method

Categories

(Firefox :: General, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 242010

People

(Reporter: patrick.soulas, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b2) Gecko/20050531 Firefox/1.0+
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b2) Gecko/20050531 Deer Park Alpha 1

The following short xul example works fine with Firefox 1.0.4 and not with Deer
Park Alpha 1. When you push on the OK button, the title value of the selected
item should appear in an alert window. With Deer Park, an exception occurs (see
actual results for exception details).

<?xml version="1.0" encoding="UTF8" ?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>

<window id="winTree" title="Tree example" orient="vertical"
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <script type='application/x-javascript'>
    function cgValidSelect(aTreeId, aColId) {
	var lTree = document.getElementById(aTreeId);
		
	//Get selected item
	var lCurLig = lTree.currentIndex;
		
	if(lCurLig >= 0) {
	   // Get content of the selected item
	   var lCurText = lTree.view.getCellText(lCurLig,aColId);
	   alert(lCurText);
	}
	else {
	   alert("Choose an item, please.");
	   return false;
	}
	return true;
    }
  </script>
	
  <groupbox orient="vertical" align="center">
    <tree id="treeTest" rows="8" seltype="single" >
      <treecols>
        <treecol id="colTest_code" label="Code" minwidth="60" />
        <treecol id="colTest_title" label="Title" minwidth="200" />
      </treecols>
      <treechildren id="trchTest1">
        <treeitem id="tritTest1">
          <treerow>
            <treecell id="celTest_code_1" label="11111" />
            <treecell id="celTest_title_1" label="Deer Park Howto" />
          </treerow>
        </treeitem>
	<treeitem id="tritTest2">
          <treerow>
            <treecell id="celTest_code_2" label="22222" />
            <treecell id="celTest_title_2" label="JavaScript Howto" />
          </treerow>
        </treeitem>
        <treeitem id="tritTest3">
          <treerow>
            <treecell id="celTest_code_3" label="33333" />
            <treecell id="celTest_title_3" label="Get Cell Text Howto" />
          </treerow>
        </treeitem>
      </treechildren>
    </tree>
    <separator orient="horizontal" />
    <button id="btnValidSel" label="OK" default="true"
      oncommand="cgValidSelect('treeTest','colTest_title')" />
  </groupbox>
</window>



Reproducible: Always

Steps to Reproduce:
1. Save the test example in a .xul file
2. Load the .xul file with Deer Park
3. Push on the OK button

Actual Results:  
An exception occurs generating the following message in the JavaScript Console :
Error: uncaught exception: [Exception... "Could not convert JavaScript argument
arg 1 [nsITreeView.getCellText]"  nsresult: "0x80570009
(NS_ERROR_XPC_BAD_CONVERT_JS)"  location: "JS frame :: file://tmp/tst.xul ::
cgValidSelect :: line 20"  data: no]

Expected Results:  
The "title" value of the selected item should appear in an alert window.
The API has changed, see Bug 221619 for more information.

*** This bug has been marked as a duplicate of 242010 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Summary: XUL : Conversion Exception in nsITreeView.getCellText method → XUL : Conversion Exception in nsITreeView.getCellText method
You need to log in before you can comment on or make changes to this bug.