简体   繁体   English

m是未定义的 - sorttable.js在三列上排序时

[英]m is undefined - sorttable.js when sorting on three columns

When I am trying to sort on three columns (State, Status, and Queue), I get a javascript error that says m is undefined (292 out of range 32). 当我尝试对三列(状态,状态和队列)进行排序时,我得到一个javascript错误,表示m未定义(292超出范围32)。 I don't think that this error is getting originated in the sorttable.js file. 我不认为这个错误来自于sorttable.js文件。 It is pointing me to the jquery.min.js file. 它指向我jquery.min.js文件。 I can't tell why these three columns are having problems, since the data within them is pretty standard (just words, never blank). 我不知道为什么这三列有问题,因为它们中的数据非常标准(只是单词,从不空白)。 It seems to just keep sorting by whichever column was last successfully sorted. 它似乎只是按上次成功排序的列进行排序。

Here is the code: 这是代码:

User clicks on "Go" Button - sends ajax query request to another page, which populates the results. 用户点击“开始”按钮 - 将ajax查询请求发送到另一个页面,该页面填充结果。

function SubmitSearch() {
    $("#searchResults").html('<br/><center><img src="../Images/barberpole.gif" style="margin-top:3px;"></center>');

    //Deleted all initializing code. There is no problem with this.         

    $.ajax(
    {
        type: "POST",
        url: "../ajaxURLs/SearchRequests.aspx?requestID=" + requestID,
        cache: false,
        success: function (data) {
            $("#searchResults").html(data);
            sorttable.makeSortable(document.getElementById("SearchResults"));
        }
    });
}

Table

<asp:GridView ID="SearchResults" runat="server" AutoGenerateColumns="False" DataKeyNames="requestNumber"  CSSClass="mailGrid" 
             OnRowDataBound="SearchRedirect">
                <Columns>
                  <asp:BoundField DataField="requestNumber" HeaderText="Request Number" InsertVisible="False" ReadOnly="True" />
                  <asp:BoundField DataField="state" HeaderText="State" />
                  <asp:BoundField DataField="status" HeaderText="Status" />
                  <asp:BoundField DataField="queue" HeaderText="Queue" />
                  <asp:BoundField DataField="oem" HeaderText="OEM"/>
                  <asp:BoundField DataField="rayMaterialNum" HeaderText="Material Number"/>
                  <asp:BoundField DataField="mfgPartNumber" HeaderText="Mfg Part Number"/>
                  <asp:BoundField DataField="program" HeaderText="Program"/>
                  <asp:BoundField DataField="purchaseOrder" HeaderText="Purchase Order" />
                  <asp:BoundField DataField="purchReq" HeaderText="Purchase Requisition"/>
                  <asp:BoundField DataField="businessUnit" HeaderText="Business Unit"/>
                  <asp:BoundField DataField="site" HeaderText="Site"/>
                  <asp:BoundField DataField="buyer" HeaderText="Buyer"/>
                  <asp:BoundField DataField="requisitioner" HeaderText="Requisitioner"/>
                  <asp:BoundField DataField="componentEngineer" HeaderText="Component Engineer"/>
                  <asp:BoundField DataField="responsibleEngineer" HeaderText="Responsible Engineer"/>
                  <asp:BoundField DataField="qualityEngineer" HeaderText="Quality Engineer"/>
                </Columns>
          </asp:GridView>

I'm using version 2 of sorttable.js, Firefox 13.0.1, jquery v1.7.2 我正在使用sorttable.js的第2版,Firefox 13.0.1,jquery v1.7.2

Generated html: 生成的html:

<table id="SearchResults" class="mailGrid" cellspacing="0" border="1" style="border-collapse:collapse;" rules="all">
<thead>
<tr>
<th class=" " scope="col">Request Number</th>
<th class=" sorttable_sorted_reverse" scope="col">
<th class=" " scope="col">Status</th>
<th class="" scope="col">Queue</th>
<th class=" " scope="col">OEM</th>
<th class=" " scope="col">Raytheon Material Number</th>
<th class="" scope="col">Mfg Part Number</th>
<th class="" scope="col">Program</th>
<th class="" scope="col">Purchase Order</th>
<th class="" scope="col">Purchase Requisition</th>
<th class="" scope="col">Business Unit</th>
<th class="" scope="col">Site</th>
<th class="" scope="col">Buyer</th>
<th class="" scope="col">Requisitioner</th>
<th class="" scope="col">Component Engineer</th>
<th class="" scope="col">Responsible Engineer</th>
<th class="" scope="col">Quality Engineer</th>
</tr>
</thead>
<tbody>
<tr onclick="ViewRequest('2000')">
<tr onclick="ViewRequest('2001')">
<tr onclick="ViewRequest('2002')">
<tr onclick="ViewRequest('2003')">
<tr onclick="ViewRequest('2004')">
<tr onclick="ViewRequest('2005')">
<tr onclick="ViewRequest('2006')">
<tr onclick="ViewRequest('2007')">
<tr onclick="ViewRequest('2008')">
<tr onclick="ViewRequest('2009')">
<tr onclick="ViewRequest('2010')">
<tr onclick="ViewRequest('2011')">
<tr onclick="ViewRequest('2012')">
<tr onclick="ViewRequest('2013')">
<tr onclick="ViewRequest('2014')">
<tr onclick="ViewRequest('2015')">
<tr onclick="ViewRequest('2016')">
<tr onclick="ViewRequest('2017')">
</tbody>
<tfoot></tfoot>
</table>

Example of one of the tr's. 其中一个tr的例子。 They all follow this format, and the columns in question will always have data. 它们都遵循这种格式,所讨论的列将始终包含数据。

<tr onclick="ViewRequest('2000')">
<td>2000</td>
<td>Open</td>
<td>Initiated</td>
<td>Buyer</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>0</td>
<td>0</td>
<td>0179450</td>
<td>Pending</td>
<td>Pending</td>
<td>Pending</td>
<td>Pending</td>
</tr>

据我所知,你应该将class =“sortable”添加到你想要排序的任何表中,也许这可以解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM