Author: max
Date: 2007-08-19 10:18:15 -0700 (Sun, 19 Aug 2007)
New Revision: 6151

Modified:
   openlaszlo/branches/wafflecone/lps/components/base/datalistselector.lzx
Log:
Change 20070817-maxcarlson-o by [EMAIL PROTECTED] on 2007-08-17 18:21:44 PDT
    in /Users/maxcarlson/openlaszlo/wafflecone
    for http://svn.openlaszlo.org/openlaszlo/branches/wafflecone

Summary: datalistselector fixes

New Features:

Bugs Fixed: LPP-4315 - "datalistselector#findIndex(..)" attempts to compare a 
"LzDataElement" against a "LzView", LPP-4316 - 
"datalistselector#getItemByData(..)" and 
"datalistselector#getItemIndexByData(..)" should test against null

Technical Reviewer: promanik
QA Reviewer: jcrowley
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details: Updated findIndex() per LPP-4315, getItemByData() and 
getItemIndexByData() per LPP-4316.
    

Tests:



Modified: 
openlaszlo/branches/wafflecone/lps/components/base/datalistselector.lzx
===================================================================
--- openlaszlo/branches/wafflecone/lps/components/base/datalistselector.lzx     
2007-08-19 06:43:15 UTC (rev 6150)
+++ openlaszlo/branches/wafflecone/lps/components/base/datalistselector.lzx     
2007-08-19 17:18:15 UTC (rev 6151)
@@ -149,8 +149,8 @@
             }
 
             if ( ! immediateparent.subviews[0].cloneManager ) {
-                return (immediateparent.subviews[0] == target_element ? 0 : 
-1);
-            }
+                return (immediateparent.subviews[0] == s ? 0 : -1);
+            } 
 
             var nodelist = immediateparent.subviews[0].cloneManager.nodes;
             var found_index = -1;
@@ -223,25 +223,27 @@
 
         <method name="getItemByData" args="data">
             <![CDATA[ 
-                return getItemByIndex( this.getItemIndexByData( data ) );
+                return data ? getItemByIndex( this.getItemIndexByData( data ) 
) : null;
             ]]>
         </method>
 
         <method name="getItemIndexByData" args="data">
             <![CDATA[ 
-            var svs = immediateparent.subviews;
-            if (svs[0].cloneManager) {
-                var nodes = svs[0].cloneManager['nodes'];
-                if( nodes != null ) {
-                   for ( var i = 0; i< nodes.length; i++ ){
-                      if ( nodes[ i ] == data ){
-                          return i;
-                      }
-                   }
+            if (data) {
+                var svs = immediateparent.subviews;
+                if (svs[0].cloneManager) {
+                    var nodes = svs[0].cloneManager['nodes'];
+                    if( nodes != null ) {
+                        for ( var i = 0; i< nodes.length; i++ ){
+                            if ( nodes[ i ] == data ){
+                                return i;
+                            }
+                        }
+                    }
+                } else if( svs[0].datapath.p == data ) {
+                    return 0;
                 }
             }
-            else if( svs[0].datapath.p == data )
-              return 0;
             return null;
             ]]>
        </method>


_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins

Reply via email to