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