2017-06-18 24 views
0

ここにgetDataメソッドがあり、複数の条件を使用して行を取得できません。 私は行の条件が一致する入力値を設定しようとしています。属性は、あなたがそれをクローズする必要が終了した後、それはまだ複数の条件を使用して行を検索する方法

function getData() { 

    $.ajax({ 
     type: 'POST', 
     url: APIUrl + 'api/GetCustomerProductDetailsDetailByEmployeeID?JSONStringData=' + JSON.stringify(objReqCustomerProductDetails), 
     dataType: 'json', 
     contentType: 'application/json; charset=utf-8', 
     crossDomain: true, 
     success: function (data, textStatus, xhr) { 
      objResCustomerProductDetails = data; 

      if ($(objResCustomerProductDetails.CustomerProductDetails).length > 0) { 

       $.each(objResCustomerProductDetails.CustomerProductDetails, function() { 

        $('#tbCustomer tbody tr[data-id=' + this.CustomerID + ' data-product-id=' + this.ProductID + '] td').find('input').val(parseFloat(this.Quantity.toString().trim()).toFixed(2)); 

       }); 
      } 

     }, 
     error: function (xhr, textStatus, errorThrown) { 

      messageProvider(0, errorThrown); 
     } 
    }); 
} 

答えて

2
$('#tbCustomer tbody tr[data-id=' + this.CustomerID + '][data-product-id=' + this.ProductID + '] td').find('input').val(parseFloat(this.Quantity.toString().trim()).toFixed(2)); 

を働いていません。条約は[attr1][attr2]です。これは上記のコードの問題でした。

Ref:https://api.jquery.com/multiple-attribute-selector/

+0

ありがとう。もう一度。 –

+0

喜んで、この答えがあなたの問題を解決した場合は、答えの横にあるチェックマークをクリックして、それを合格とマークしてください。 – gauravmuk

+0

私はそれについて知っています。それは5分かかります。 –

関連する問題