2012-03-27 1 views
0
내가 지금처럼 목록에서 일부 데이터를 얻을 수 SPServices을 사용하고

:나는 SP 서비스 (JQuery와)과 HTML 테이블을 구축 도움이 필요

listSiteTabURLSalesTool = 'http://myServer'; 
     $().SPServices({ 
     operation: "GetListItems", 
     webURL: listSiteTabURL, 
     listName: 'Follow', 
     async: false, 
     CAMLQuery:"<Query><Where><Eq><FieldRef Name='Location'/><Value Type='Text'>" + store + "</Value></Eq></Where></Query>", 
     CAMLViewFields:"<ViewFields><FieldRef Name='Title'/><FieldRef Name='Location'/></ViewFields>", 
     completefunc: function (xData, Status) { 


    $(xData.responseXML).find("[nodeName='z:row']").each(function() { 

       var title = $(this).attr("ows_Title"); 

      var store = $(this).attr("ows_Location"); 

      var data = title + "-" + store; 



      }); 
       $("#idfollowup").append(data); 

      } 
     }); 

을하지만 난 그것을 사용이 표를 구축하고 싶습니다 데이터 테이블 플러그인 :

<div id="idfollowup"> 
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example" width="100%"> 
    <thead> 
     <tr> 
      <th>Titlee</th> 
      <th>Location</th> 

     </tr> 
    </thead> 
    <tbody> 

     <tr> 
      <td>Title</td> 
      <td>Location</td> 

     </tr> 

    </tbody> 
</table> 
</div> 

어떤 도움을 주시면 감사하겠습니다.

감사

답변

2

당신은 당신이 열 단지 값보다는 방출 할 마크 업을 구축해야한다. (아마 정확히 잘 안된 등) 이런 식으로 뭔가 :

  var title = $(this).attr("ows_Title"); 
     var store = $(this).attr("ows_Location"); 
     var data = "<tr><td>" + title + "</td><td>" + store + "</td></tr>; 

는 또한 바깥 DIV 아니라 그 안에 테이블에 데이터를 추가하고 있습니다. 따라서