2014-06-27 49 views
0

花費了大量資源來弄清楚如何優化extJs HTML代碼。 我有一個標籤和ExtJS的組合框簡單拋出一個頁面這:ExtJs HTML/DOM代碼優化

<tr role="presentation" id="inputs[1].TypeId-inputRow" class="x-form-item-input-row"> 
    <td role="presentation" id="inputs[1].TypeId-labelCell" style="" valign="top" halign="left" width="88" class="x-field-label-cell"> 
     <label 
     id="inputs[1].TypeId-labelEl" 
     for="inputs[1].TypeId-inputEl" 
     class="x-form-item-label x-unselectable x-form-item-label-left" 
     style="width:83px;margin-right:5px;" unselectable="on"> 

     Placement ID: 
    </label> 
    </td> 
    <td role="presentation" class="x-form-item-body x-form-trigger-wrap-focus" id="inputs[1].TypeId-bodyEl" colspan="2"> 
    <table id="inputs[1].TypeId-triggerWrap" class="x-form-trigger-wrap" cellpadding="0" cellspacing="0" style="table-layout: auto;"> 
     <tbody> 
     <tr> 
      <td id="inputs[1].TypeId-inputCell" class="x-form-trigger-input-cell"> 
        <div class="x-hide-display x-form-data-hidden" role="presentation" id="ext-gen1311"> 
      </div> 
      <input 
       id="inputs[1].TypeId-inputEl" 
       type="text" 
       class="x-form-field x-form-required-field x-form-text x-trigger-noedit x-form-focus x-field-form-focus x-field-default-form-focus" 
       autocomplete="off" 
          name="inputs[1].TypeId" 
       placeholder="DATA SOURCE" 
       readonly="readonly" 
       aria-invalid="false" 
       data-errorqtip="" 
       style="width: 137px;"> 
      </td> 
        <td valign="top" class=" x-trigger-cell x-unselectable" style="width:22px;" id="ext-gen1310"> 
      <div class="x-trigger-index-0 x-form-trigger x-form-arrow-trigger x-form-trigger-first" role="button" id="ext-gen1309"> 
      </div> 
      </td> 
     </tr> 
     </tbody> 
    </table> 
    </td> 
</tr> 

我應該如何改變表一表內只是簡單的xtype:「組合框」? 我在頁面上有上百個,因爲非常沉重的HTML代碼會減慢很多。

它可以用簡單的div來完成,爲什麼extJS會呈現所有這些表代碼?

+0

分機很漂亮,它從HTML中抽象出來。那麼當你不需要用Ext中的HTML語言思考時,爲什麼你需要更改底層的HTML? – Saki

+0

,因爲我不想在我的頁面上使用多少HTML,因爲它可以在幾個div中完成 – antohoho

回答

0

如果你想/需要一個更簡單的標記在Ext中,唯一的方法是編寫你自己的組件,你可以定義一個更簡單的組件。

沒有辦法簡化Ext生成的標記,而沒有破壞功能或佈局引擎的危險。