History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LPP-3811
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: -- --
Assignee: Mamye Kratt
Reporter: notzippy
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
OpenLaszlo

Local datasets do not work in datacomboboxes

Created: 30/Mar/07 06:09 AM   Updated: 27/Sep/07 03:57 PM
Component/s: Components - base
Affects Version/s: 3.3, 3.4, 3.3.3, OL4B1, 4.0.0
Fix Version/s: Legals

Time Tracking:
Not Specified

Severity: Minor
Fixed in Change#: 6,651
Fixed in branch: trunk
Runtime: N/A
Fix in hand: True


 Description  « Hide
A local dataset does not show up in a combo box
Code:
<canvas width="100%" height="100%" debug="true" >
  <class name="inner" >
    <dataset name="dsFonts" >
      <fonts>
        <font value="Courier" >Courier</font>
        <font value="Courier-Bold" >Courier-Bold</font>
        <font value="Courier-Oblique" >Courier-Oblique</font>
        <font value="Courier-BoldOblique" >Courier-BoldOblique</font>
        <font value="Helvetica" >Helvetica</font>
      </fonts>
    </dataset>
      <datacombobox itemdatapath="local:classroot.dsFonts:/fonts/font" />
  </class>
  <inner />
</canvas>

A fix to the combox was suggested at http://forum.openlaszlo.org/showthread.php?t=7149. It is the following (Which is a modification of the existing method setupcblist).

      <datacombobox itemdatapath="local:classroot.dsFonts:/fonts/font" >
        <!--- @keywords private -->
        <method name="_setupcblist" args="force"> <![CDATA[

            if (this._cblist == null) {
            
                if (this.itemclassname == "") {
                    this.itemclassname = "basedatacombobox_item";
                }
    
                var icn = this.itemclassname;

                var flcn = this.menuclassname;
                if ($debug) {
                    if (typeof global[flcn] == "undefined")
                        Debug.format("basedatacombobox floatinglist class (%w) is undefined", flcn);
                }
                
                var cblist = new global[flcn](this,
                                              { visible:false,
                                                attach: this.listattach,
                                                attachoffset: -2,
                                                itemclassname: icn
                                              });
                
                // add in a white view to reduce the visual effect of the
                // list items appearing as they are created
                var tmp = new global[icn](cblist, { name:'item' });
                new LzDatapath(tmp, { pooling: true });
                
                this._cblist = cblist;

                // Make sure we deselect if we're acting like a menu
                if (this.ismenu) {
                    cblist._selector.clearSelection();
                }

                var w = ( this.listwidth != null ? this.listwidth : this.width );
                cblist.setWidth(w);
                cblist.setAttachTarget(this);
                cblist.setAttribute('shownitems', this.shownitems);
                
                //local-dataset-modification by senshi
                var itd = this.itemdatapath;
                if (itd.indexOf( "local:" ) == 0) {
                  itd = "local:" + "parent.owner." + itd.substring( 6 );
                  if ($debug)
                    Debug.write( "local-dataset-modification:" + itd );
                }
        
                cblist.item.setDatapath(itd);

                cblist.setAttribute('attach', this.listattach);
                if (this._selectdel == null) {
                    this._selectdel = new LzDelegate( this, "_flistselect" );
                }
                this._selectdel.register(cblist, 'onselect');
            }
            
            if (! this.ismenu) {
                // Set the item for _cblist
                var item = _getItemAt(this._selectedIndex);
                this._cblist.select(item);
            }
            ]]>
        </method>

</datacombobox>

Thanks

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
P T Withington - 01/May/07 11:29 AM
This looks like you just need a contributor agreement for the proposed fix.

Josh Crowley - 14/May/07 11:07 PM
Contacted about contributor agreement 5/14/2007.

André Bargull - 13/Jul/07 12:17 PM
I'm just curious about the current state of this task.
Josh Crowley said, he had "contacted" the contributor in may. But that would mean he'd contacted me (again), as it was me how posted this changes in the forum. "notzippy" just created this task on JIRA (thanks to him).
So, you have any updates on this?

Josh Crowley - 13/Jul/07 12:31 PM
Ah, sorry, I contacted Notzippy about this and he corrected me about the authorship of this code. I guess I forgot to make the comment that a contributor's agreement was already in place.

This will be integrated soon, likely within the next week.

Josh Crowley - 27/Sep/07 03:57 PM
Approved by Ben. Checkin transcript follows:


Author: jcrowley
Date: 2007-09-27 15:52:59 -0700 (Thu, 27 Sep 2007)
New Revision: 6651

Modified:
  openlaszlo/trunk/lps/components/base/basedatacombobox.lzx
  openlaszlo/trunk/lps/components/lz/datacombobox.lzx
Log:
Change 20070926-jcrowley-K by jcrowley@doctormanhattan.mshome.net on 2007-09-26 04:47:38 EDT
   in /Users/jcrowley/src/svn/openlaszlo/trunk-a
   for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Local datasets do not work in datacomboboxes;
       datacombobox getText() missing

New Features:

Bugs Fixed: LPP-3811 - Local datasets do not work in datacomboboxes
       LPP-4468 - datacombobox getText() missing

Technical Reviewer: pbr
QA Reviewer: ben
Doc Reviewer:

Documentation:

Release Notes:

Details: Andre Bargull - LPP-3811. Implemented his change
       to basedatacombobox. (This was still pending review;
       ignore pending changeset 20070814-jcrowley-n.)

       Chris Bartak - LPP-4468. Implemented his change
       to add getText() to datacombobox.

Tests: For LPP-3811:

[Removed this code due to a complaint from SVN about line
ending styles being inconsistent.]



Modified: openlaszlo/trunk/lps/components/base/basedatacombobox.lzx
===================================================================
--- openlaszlo/trunk/lps/components/base/basedatacombobox.lzx 2007-09-27 22:34:07 UTC (rev 6650)
+++ openlaszlo/trunk/lps/components/base/basedatacombobox.lzx 2007-09-27 22:52:59 UTC (rev 6651)
@@ -197,7 +197,7 @@

            var t = dp.xpathQuery(this.textdatapath);
            // if t is null, use default text (if it exists)
- if( ( t == null || t.length == 0 ) && this.defaulttext && this.defaulttext['length'] > 0 )
+ if( ( t == null || t.length == 0 ) && this.defaulttext['length'] > 0 )
               t = this.defaulttext;

            if ( this._cbtext && (this.statictext == null) ) {
@@ -215,7 +215,7 @@
            if (this.ismenu) {
                // Clear the selection
                this._selectedIndex = -1;
- if (this._cblist && this._cblist['_selector']) {
+ if (this._cblist['_selector']) {
                    this._cblist._selector.clearSelection();
                }
            }
@@ -230,13 +230,12 @@

        <!--- @keywords private -->
        <method name="_setupcblist" args="force"> <![CDATA[
+ if (this._cblist == null) {

- if (this._cblist == null) {
-
                if (this.itemclassname == "") {
                    this.itemclassname = "basedatacombobox_item";
                }
-
+
                var icn = this.itemclassname;

                var flcn = this.menuclassname;
@@ -244,19 +243,19 @@
                    if (typeof global[flcn] == "undefined")
                        Debug.format("basedatacombobox floatinglist class (%w) is undefined", flcn);
                }
-
+
                var cblist = new global[flcn](this,
- { visible:false,
- attach: this.listattach,
- attachoffset: -2,
+ { visible:false,
+ attach: this.listattach,
+ attachoffset: -2,
                                                itemclassname: icn
                                              });
-
+
                // add in a white view to reduce the visual effect of the
                // list items appearing as they are created
                var tmp = new global[icn](cblist, { name:'item' });
                new LzDatapath(tmp, { pooling: true });
-
+
                this._cblist = cblist;

                // Make sure we deselect if we're acting like a menu
@@ -268,15 +267,24 @@
                cblist.setWidth(w);
                cblist.setAttachTarget(this);
                cblist.setAttribute('shownitems', this.shownitems);
- cblist.item.setDatapath(this.itemdatapath);

+ //local-dataset-modification by senshi
+ var itd = this.itemdatapath;
+ if (itd.indexOf( "local:" ) == 0) {
+ itd = "local:" + "parent.owner." + itd.substring( 6 );
+ if ($debug)
+ Debug.write( "local-dataset-modification:" + itd );
+ }
+
+ cblist.item.setDatapath(itd);
+
                cblist.setAttribute('attach', this.listattach);
                if (this._selectdel == null) {
                    this._selectdel = new LzDelegate( this, "_flistselect" );
                }
                this._selectdel.register(cblist, 'onselect');
            }
-
+
            if (! this.ismenu) {
                // Set the item for _cblist
                var item = _getItemAt(this._selectedIndex);

Modified: openlaszlo/trunk/lps/components/lz/datacombobox.lzx
===================================================================
--- openlaszlo/trunk/lps/components/lz/datacombobox.lzx 2007-09-27 22:34:07 UTC (rev 6650)
+++ openlaszlo/trunk/lps/components/lz/datacombobox.lzx 2007-09-27 22:52:59 UTC (rev 6651)
@@ -32,6 +32,10 @@
        <!--- Tell base class about our label view.
              @keywords private -->
        <attribute name="_cbtext" value="$once{this._text}" />
+
+ <method name="getText">
+ return _text.getText();
+ </method>

        <!--- @access private -->
        <method name="_showEnabled">