1

私のモデルには clientName model/AlertConfig.js があります:

Ext.define('ET.model.AlertConfig', {
    extend: 'Ext.data.Model',
    fields: [
             {name: 'id', type: 'string'},
             {name: 'clientName', type: 'string' },
             {name: 'description', type: 'string'},

着信 xml には、クライアント オブジェクト全体が埋め込まれています (存在する場合)。

<alertConfig>

    <commandType>D</commandType>
    <countThreshold>1</countThreshold>
    <description>Distributions that failed(all clients)</description>
    <id>2</id>
    <processTimeExceedsSec>0</processTimeExceedsSec>
    <status>3</status>
    <windowMinutes>120</windowMinutes>
  </alertConfig>
  <alertConfig>
    <client>
      <clientCategory>abc</clientCategory>
      <clientExtId>12345</clientExtId>
      <clientId>1</clientId>
      <clientName>MyClient1</clientName>
      <lastModified>2013-03-19T16:12:54.774-04:00</lastModified>
    </client>
    <commandType>R</commandType>
    <countThreshold>1</countThreshold>
    <description>Requests that failed</description>
    <id>3</id>
    <processTimeExceedsSec>0</processTimeExceedsSec>
    <status>3</status>
    <windowMinutes>120</windowMinutes>
  </alertConfig>

質問:

モデルで clientName にマップする必要があるのは、alertConfig/client/clientName だけです。どうすればきれいにできますか。このxmlパスについて言及できる場所はありますか?

注: ビューでは、ユーザーには ClientName が表示されます (およびコンボボックス内のすべての clientNames で、ユーザーはアラートの別の clientName を選択して更新できます)。

4

1 に答える 1

0

「/」を追加することで解決

Ext.define('ET.model.AlertConfig', {
    extend: 'Ext.data.Model',
    fields: [
             {name: 'id', type: 'string'},
             {name: 'clientId', mapping: 'client/clientId', type: 'int' }, 
             //not a field in erf.domain (but points to Client object)
             {name: 'clientName', mapping: 'client/clientName', type: 'string' }, // not a field in erf.domain
             {name: 'description', type: 'string'},
于 2013-04-19T15:46:05.970 に答える