-1

多くの質問がこのように尋ねられているので、これは重複した質問のように聞こえるかもしれません.

通常の ajax 呼び出しを使用して、サーバーから次の応答を取得しています。

<form id="ctl00" name="ctl00" method="post" action="RatesGrids.aspx?pt=EMPL&amp;RT=bill">
   <div>
     <input id="__VIEWSTATE" type="hidden" name="__VIEWSTATE" value="/wEPDwUENTM4MQ9kFgJmD2QWAmYPPCsADQEADxYCHgtfIUl0ZW1Db3VudAICZGQYAQUMZ3JkQmlsbFJhdGVzDzwrAAoBCAIBZE4pvNtSHIbu7h7ISmN42ktJBm5R">
   </div>
   <div>
      <table id="grdBillRates" class="tableView" cellspacing="0" rules="all" border="1" style="width:100%;border-collapse:collapse;">
          <thead>
             <tr class="tableViewHeader">
                <th scope="col" style="white-space:normal;">Emp. Id</th>
                <th scope="col" style="white-space:normal;">Last Name</th>
                <th scope="col" style="white-space:normal;">*Res Usage</th>
                <th scope="col" style="white-space:normal;">Source</th>
                <th scope="col" style="white-space:normal;">Eff. Date</th>
                <th scope="col" style="white-space:normal;">*Bill 1</th>
                <th scope="col" style="white-space:normal;">*Bill 2</th>
                <th class="display_none" scope="col" style="white-space:normal;"></th>
                <th class="display_none" scope="col" style="white-space:normal;">Time Stamp</th>
                <th scope="col" style="white-space:normal;">Currency</th>
            </tr>
         </thead>
         <tbody>
            <tr class="tableViewRow" onclick="loadrowitems(0,this)" onmouseover="this.style.cursor='default';">
                  <td style="width:100px;white-space:normal;">10000000034 </td>
                  <td style="width:125px;white-space:normal;">Khan</td>
                  <td style="width:125px;white-space:normal;"></td>
                  <td style="width:80px;white-space:normal;">Local</td>
                  <td style="width:80px;white-space:normal;">12/04/2012</td>
                  <td align="right" style="width:80px;white-space:normal;">3.6500</td>
                  <td align="right" style="width:80px;white-space:normal;">6.0000</td>
                  <td class="display_none" style="width:0px;white-space:normal;">Z-C$ </td>
                  <td class="display_none" style="white-space:normal;">0,0,0,0,1,107,21,255</td>
                  <td style="width:70px;white-space:normal;">Z-C$</td>
            </tr>
            <tr class="tableViewAlternatingRow" onclick="loadrowitems(1,this)" onmouseover="this.style.cursor='default';">
                <td style="width:100px;white-space:normal;">10000000034 </td>
                <td style="width:125px;white-space:normal;">Khan</td>
                <td style="width:125px;white-space:normal;">444 </td>
                <td style="width:80px;white-space:normal;">Local</td>
                <td style="width:80px;white-space:normal;">12/04/2012</td>
                <td align="right" style="width:80px;white-space:normal;">2.1000</td>
                <td align="right" style="width:80px;white-space:normal;">3.2000</td>
                <td class="display_none" style="width:0px;white-space:normal;">Z-C$ </td>
                <td class="display_none" style="white-space:normal;">0,0,0,0,1,107,21,254</td>
                <td style="width:70px;white-space:normal;">Z-C$</td>
           </tr>
        </tbody>
     </table>
   </div>
</form>

今、私は応答でテーブルを追加する必要があります<div id="grdRates"></div>.

私が取り組んでいるアプリケーションは、IE のみを念頭に置いて作成されたため、次のコードを使用して仕出し料理されました。

if (contents) {
    var table;
    if ($(contents).find('table').length > 0)
        table = $(contents).find('table')[0].xml
        if (table) {
            $('#grdRates').parent().show();
            $('#grdRates').html(table);
        }
}

上記のコードは Firefox だけでなく Chrome でも機能せず、その xml を undefined として指定し、結果を表示しなかったため、次のことを試しました。

if (contents) {
   var table;
   if ($(contents).find('table').length > 0)
       if ($.browser.msie)
            table = $(contents).find('table')[0].xml
       else
            table = $(contents).find('#grdBillRates');

       if (table) {
          $('#grdRates').parent().show();
          if ($.browser.msie)
             $('#grdRates').html(table);
          else
             $('#grdRates').html(table.parent().html());     
       }
   }
}

#grdBillRatesは上記の HTML のテーブル ID であることに注意してください。現在、これはFirefoxで正常に機能しています(グリッドが正常に表示されています)が、クロムのほとんどすべてを試しましたが、運がありません....

もう1つ、DLLを変更できないため、ソリューションはスクリプトを使用する必要があります。どんな助けでも大歓迎です...ありがとう

4

1 に答える 1