title: Sorting/filtering a javascript-created list in a SharePoint content editor
body: <p>I'm working in SharePoint 2010, and I have a list that I want to display a very specific way. Basically, I'm using Javascript, jquery, and SPServices to query the list and build a table in a content editor web part with links differing dependent on login name and request status. Okay, so that works, but now I'm trying to sort/filter the Javascript-generated table, and it's no soup for me.</p>
  
  <p>I tried a few different Javascripts that sort and filter, and this one seems to be the one that does what I need: <a href="http://www.javascripttoolbox.com/lib/table" rel="nofollow">http://www.javascripttoolbox.com/lib/table</a> It does work if I create an HTML table in the content editor web part, but if the table's not present on page load that's where the issues start arising.</p>
  
  <p>Any help or suggestions are much appreciated. </p>
  
  <p>Here's a few snippets of code:</p>
  
  <pre><code>&lt;table class="table-autosort table-autofilter" id="openReqTable" bordercolor="#000000" border="1" cellspacing="0" cellpadding="5"&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th class="table-sortable:numeric table-filterable"&gt;Request ID&lt;/th&gt;
          &lt;th&gt;
  ...
          &lt;/th&gt;
          &lt;th&gt;Request Status&lt;/th&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;&lt;/tbody&gt;&lt;/table&gt;
  &lt;script src="/Utilities/jquery-1.4.2.min.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="/Utilities/jquery.SPServices-0.5.7.min.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      var tableRowCount = 1;
      var query;
  ...
  
      $(document).ready(function()
      {
          currentUserVar = $().SPServices.SPGetCurrentUser({
              fieldName: "UserName",
              debug: false
          });
  
  ...
  
      var groupCollectionVar = $().SPServices({
                                  operation: "GetGroupCollectionFromUser",
                                  userLoginName: currentUserVar,
                                  completefunc: groupTestFunc
                                  });
  });
  
  function groupTestFunc(xData,status)
  {
  ...
          newRow=document.getElementById('openReqTable').insertRow(tableRowCount);
          newTableColumnA=newRow.insertCell(0);
  ...
          newTableColumnK=newRow.insertCell(10);
  ...
          newTableColumnA.innerHTML=requestIDLink;
  ...
          newTableColumnK.innerHTML=requestStatus;
          tableRowCount++;
      });
  }&lt;/script&gt;&lt;script src="/Utilities/table.js" type="text/javascript"&gt;&lt;/script&gt;
  </code></pre>