0

I have to dynamically load a set of values based on the value i chose in another drop down.

In Controller I have the following code,

def ajaxGetCities(params){

println params.id
def userCustPlantDetails = utilitySummaryService.fetchUserCustPlantDetails('PHILL00')

def data = []
userCustPlantDetails?.get('UserPlantList').collect{
        data << it.pwr_plt_nme
}

[data: data]

}

In gsp I have :

 <g:select class="btn btn-default" name="viewValue" from="${view}" onchange="${remoteFunction(
        action:'ajaxGetCities', 
        params:'\'id=\' + escape(this.value)', 
        onSuccess :'updateCity(data)')}"></g:select>

When I change the value of dropdown , i see the trigger and controller action is called. Post that Javascript updateCity is not responding. What am I missing ? What is the difference between onComplete and OnSuccess.

Vinodh Thiagarajan
  • 758
  • 3
  • 9
  • 19
  • http://stackoverflow.com/questions/18925786/grails-chain-selects-without-domains (Possible Duplicate) Solved my problem. I'm supposed to return as JSON. Is my understanding correct ? – Vinodh Thiagarajan Sep 26 '14 at 22:23
  • I believe RemoteFunction may also be deprecated and that's not how you use collect. Should be: def data = userCustPlantDetails?.get('UserPlantList').collect{ it.pwr_plt_nme } – Jim Sosa Sep 29 '14 at 19:19

0 Answers0