views:

258

answers:

2

Hi all,

I am a newbie to grails/extjs I am developing a web based config tool for my team .My issue is with comboboxes of extjs I have three remote comboxes(many to one hibernate mappng).I am using hiddenName to submit its value field(which is id primay key of database) instead of its display field which is name which i get by rendering it as json.some how I see that if I select diff index other than which is loaded from db and try updating it.it definitely sends it as params but in save method of grails its not updated.

I want to understand Why? I have pasted snippetof both combobox and grails method?

{
           xtype : 'combo',
           id:'cpsServerid',
           fieldLabel : 'CpsServer',
           name : 'cpsServer',
            //hiddenId:'cpsID',
            hiddenName:'cpsID',
               store: cpsServerStore,
            displayField:'NAME',
            valueField:'ID',
            editable:true,
            typeAhead:true,
            mode:'remote',
            triggerAction:'all',
                  width:300,
            autoScroll:true,
            selected:name,
            selectOnFocus:true},

GRAILS SAVE

 def saveApplicationSubscription = {
         println "saveApplicationSubscription, params = $params"
         ApplicationSubscription subscription 

  if (params.id) {
           subscription  =  ApplicationSubscription.get(params.id as int)
           subscription.cpsServer = CpsServer.get(params.cpsID as int)
           subscription.topic =  params.topic
              subscription.description = params.description
              subscription.subscriberApplication = SubscriberApplication.get(params.subAppID as int)
              subscription.outputQueue = OutputQueue.get(params.outputID as int)
              bindData(subscription , params)
        }
   else {
           params.id = 0
           subscription = new ApplicationSubscription(params)
           subscription.id = params.id as int 
           subscription.cpsServer = CpsServer.get(params.cpsID as int )
           subscription.topic =  params.topic
           subscription.description = params.description
           subscription.subscriberApplication = SubscriberApplication.get(params.subAppID as int)
           subscription.outputQueue = OutputQueue.get(params.outputID as int)
         //  subscription.messageFormat = params.messageFormat


       }
if (subscription.save()) {

         log.info("Saved ApplicationSubscription $subscription")
         render([success: true] as JSON)

     }
     else {
         log.info("Failed to save ApplicationSubscription $subscription, errors = ${subscription.errors}")
         render([success: false, errors: subscription.errors] as JSON)
     }
 }

I would really apperciate any help

A: 

Have you verified in the Firebug console tab that your POST looks like what you expect? That would confirm whether or not your issue is on the client or server.

bmoeskau
A: 

hanks for quick reply ..yes i have verified in post of firebug it is sending the id of changed selection of comboxes ...infact you might have noted i print my params to console they are also rendered correctly but i am not able to set the value in comboboxes... all fields except remote combos are getting updated textfield textarea etc

abhi
Could you please post the code for your SubscriptionApplication.get method as well?
Bytecode Ninja