2

検索機能の問題に直面しています。データを検索していますが、任意の値を入力してデバッグすると、次の行でエラーが発生しました。

if (column.searchable && column.visible &&
                    column.converter.to(row[column.id]).search(searchPattern) > -1)
私の実装:

$(document).ready(function()
{
sendRESTQuery(asmx());
});
function asmx() { 
var url = window.location.protocol + "//" + window.location.host + _spPageContextInfo.siteServerRelativeUrl;  
    var asmx =  url + "/_vti_bin/listdata.svc/AD?$select=Column1,Column2,Column5,Column7,Column9";   //?$select=Column1,Column2,Column3,Column4
   
    return asmx;
}
function testBtn() {
sendRESTQuery(asmx());
}
var baseUrl = asmx();

function sendRESTQuery(baseUrl) { 
   
    $.ajax({        
        contentType: 'application/json;odata=verbose',       
        url: baseUrl,
         headers: { 
            'X-RequestDigest': $('#__REQUESTDIGEST').val(), 
            "Accept": "application/json; odata=verbose" 
        }, 
        post: function () {alert('true')},       
        complete: function (result) {                
            var response = JSON.parse(result.responseText); 
            if (response.error) {
            } 
            else { 
               bgDetails = response.d; 
                onSuccess(bgDetails.results);                 
            } 
        }         
 
    });       
}

function onSuccess(bgDetails) {
		
      $("#grid-data").bootgrid().bootgrid("append", bgDetails);  
      $("#grid-data").bootgrid("sort", { Column2 : "asc"}).bootgrid("search", $('.search-field').val());

      
      }

<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-bootgrid/1.2.0/jquery.bootgrid.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-bootgrid/1.2.0/jquery.bootgrid.js"></script>

<table id="grid-data" class="table table-condensed table-hover table-striped" data-toggle="bootgrid" data-keep-selection="true">
<thead>
<tr>
<th data-column-id="Column1" data-type="numeric" data-identifier="true" data-visible="false" >Employee ID</th>
<th data-column-id="Column2">Full Name</th>
<th data-column-id="Column5">Department</th>
<th data-column-id="Column7" >Work Phone</th>
<th data-column-id="Column9">Email</th>
</tr>
</thead>
</table>
4

1 に答える 1