문제

I am trying to forward a keyboard event from the Collection View to all the views it contains. I've tried figuring out how to obtain an array of the views so that I could forward the event to each view, but I could not find a way to do this. I feel that I am going about this the wrong way. Any direction is appreciated.

Thank you,

charlie

도움이 되었습니까?

해결책

여기에 당신을 시작할 것이 있습니다.

function GetKeywordFromUrl() {
    var hashValue = window.location.hash;
    if (hashValue) {
        var k = hashValue.split('#k=')[1];
        if (k)
            return decodeURIComponent(k.replace(/\+/g, " "));

        //For executing keyword/filter search from a textbox
        var txtSearch = $("#your-textbox-id-here").val();
        if (txtSearch)
            return txtSearch.replace(/[^\w\s]/gi, '');
    }
    return null;
}


$(document).ready(function () {
    var resultsDiv = $('#ResultsDiv');
    resultsDiv.fadeOut('slow').delay(500).fadeIn();

    ExecuteOrDelayUntilScriptLoaded(LoadAIP, "sp.js");
    // For 2013 publishing pages use
    // SP.SOD.executeFunc('sp.js', 'SP.ClientContext', ExecuteListSearch);

    // To-Do: 
    // Change the hash value (k=) in the url, passing in the textbox value
    // Using hash value will allow to use Browser's back button to get back to previous results' page.

    $(window).bind('hashchange', function () {
        phoneBookDiv.fadeOut('slow').delay(400).fadeIn();
        //Re-execute search
        LoadAIP();
    });
});

function LoadAIP() {
  var state = GetKeywordFromUrl();
  var query = "/listdata.svc/AIPList?$select=ROCode,AIP,PIC&$top=5000";
  if(state)
    query = "/listdata.svc/AIPList?$select=ROCode,AIP,PIC&$filter=(ROCode eq '"+state+"')&$top=5000";

var call = $.ajax({
    url: _spPageContextInfo.webServerRelativeUrl + query,
    type: "GET",
    dataType: "json",
    headers: {
      Accept: "application/json;odata=verbose"
    }
  });

  call.done(function (data,textStatus, jqXHR){
    $('#example').dataTable({
        "bJQueryUI": true,
        "bDestroy": true, //Needed, to destroy and re-create table when filter/query changes
        "sPaginationType": "full_numbers",
        "aaData": data.d.results,
        "aoColumns": [
            { "mData": "ROCode" },
            { "mData": "AIP" },
            { "mData": "PIC" }
          ],
        "oLanguage": {
                "sLoadingRecords": "Loading...",
                "sProcessing": "Loading...",
                "sZeroRecords": "No records found,
                "sSearch": "<span>Filter within results:</span> _INPUT_", //Filter 
                "sInfoEmpty": "",
                "oPaginate": {
                    "sNext": "next",
                    "sLast": "last",
                    "sFirst": "first",
                    "sPrevious": "previous"
                }
            }
      });
  });

  call.fail(function (jqXHR,textStatus,errorThrown){
    alert("Error retrieving Tasks: " + jqXHR.responseText);
  });
}
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top