Changeset 1579


Ignore:
Timestamp:
2010-06-29 12:13:52 (3 years ago)
Author:
freya
Message:

solves #277 : Selecting null in selection-control causes dependent selection-control to call wrong url

  • clear options when ajax call for options fail
  • fix filling uricontext when loading options list
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/field.js

    r1558 r1579  
    201201     
    202202                me.parseOptions(data); 
    203             } 
     203            }; 
     204            var errorcallback = function( data) { 
     205                 
     206                me.clearOptions(data); 
     207            }; 
     208 
    204209            $.ajax( { 
    205210                // take async setting from setup 
     
    209214                dataType :"json", 
    210215                success :callback, 
     216                error :errorcallback, 
    211217                beforeSend: function(xhr) { 
    212218                // setting datatype to json should be enough, unfortunately 
     
    238244            this.uriContext[key] = value; 
    239245        } else { 
    240             var context = key; 
    241             for (var k in context) 
    242                 changedContext = changedContext || this.putContext(k, context[k], true); 
     246            if(this.uriContext[key] != undefined) {  
     247                // delete from context 
     248                delete this.uriContext[key]; 
     249                changedContext = true; 
     250            } 
    243251        } 
    244252             
     
    283291    } 
    284292     
     293     /** 
     294      * clear the options list 
     295      * <p> 
     296      * Note: Updating the HTML should not happen until "update" event triggers the various listeners (e.g. 
     297      * selection-control#updateOptions) 
     298      * </p> 
     299      * @param {Array} data 
     300      */ 
     301     Options.prototype.clearOptions = function( data) { 
     302 
     303         this.set([], []); 
     304     } 
    285305     
    286306         
Note: See TracChangeset for help on using the changeset viewer.