1var membershipResourcesSearch = function (options) { 2 3 var _options = 4 { 5 pageSize: options.pageSize, 6 searchUrl: options.searchUrl, 7 pageKey: 'page', 8 searchKey: 'searchText', 9 skipInitialSearch: options.skipInitialSearch || false 10 } 11 12 var dataSource; 13 var showLoading = function () { 14 $('.loaded').hide(); 15 $('.loading').fadeIn(); 16 }; 17 var hideLoading = function () { 18 $('.loading').hide(); 19 if (dataSource.total() == 0) { 20 $('#empty-records').show(); 21 } 22 else { 23 $('#empty-records').hide(); 24 $('.loaded').fadeIn(); 25 } 26 27 }; 28 29 var refreshDataSource = function () { 30 var page = dataSource.page(); 31 dataSource.transport.options.read.data.searchText = $('#search-text').val(); 32 dataSource.page(page); 33 } 34 35 var searchDataSource = function () { 36 dataSource.transport.options.read.data.searchText = $('#search-text').val(); 37 dataSource.page(1); 38 } 39 40 $("#search-button").click(function () { 41 showLoading(); 42 searchDataSource(); 43 }); 44 45 $("#clear-search-button").click(function () { 46 showLoading(); 47 $('#search-text').val(''); 48 searchDataSource(); 49 }); 50 51 var template = kendo.template($("#template").html()); 52 dataSource = new kendo.data.DataSource({ 53 change: function () { // subscribe to the CHANGE event of the data source 54 $("#data-container ul").html(kendo.render(template, this.view())); // populate the table 55 hideLoading(); 56 }, 57 type: "json", serverSorting: true, serverPaging: true, serverPaging: true, serverFiltering: true, 58 transport: { 59 read: { 60 url: _options.searchUrl, 61 dataType: "json", 62 data: { searchText: $('#search-text').val()} 63 } 64 }, 65 pageSize: _options.pageSize, 66 schema: { 67 data: "results", total: "count" 68 } 69 }); 70 71 var pager = $("#pager").kendoPager({ 72 dataSource: dataSource 73 }).data("kendoPager"); 74 75 // Only trigger initial search if not skipping 76 if (!_options.skipInitialSearch) { 77 searchDataSource(); 78 } 79 80 return { 81 refresh: refreshDataSource 82 } 83};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.