0

我是 grails/extjs 的新手 我正在为我的团队开发一个基于 Web 的配置工具。我的问题是 extjs 的组合框我有三个远程组合框(多对一个休眠 mappng)。我正在使用 hiddenName 提交其值字段(这是数据库的 id 主键)而不是它的显示字段,它是我通过将其呈现为 json 获得的名称。如果我选​​择差异索引而不是从 db 加载并尝试更新它,我如何看到它。它肯定会发送它作为参数,但在 grails 的保存方法中它没有更新。

我想了解为什么?我已经粘贴了组合框和 grails 方法的片段?

{
           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},

圣杯保存

 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)
     }
 }

我真的很感激任何帮助

4

1 回答 1

0

您是否在 Firebug 控制台选项卡中验证了您的 POST 看起来像您期望的那样?这将确认您的问题是在客户端还是服务器上。

于 2010-04-09T16:14:15.497 回答