0

I'm having problems binding events with telerik & jquery. I've found documentation where telerik has it's version of jquery integrated, in this case it's 1.9.1:

$telerik.$(document).ready(function () {

    //alert("in telerik doc ready");
    PartsWasherDetails.init();

 });

I'm trying to use the revealing module pattern as well. Here are the ways I tried to bind the click event:

    //no-go
    pws.clearButton.on("click", function (e) {
           e.preventDefault();
           PartsWasherDetails.clear();
     });

     // no-go  .id is undefined. I tried getAttribute('id), attr & prop
       $telerik.$(pws.clearButton.id).click(function (e) {
           e.preventDefault();
           PartsWasherDetails.clear();
       });

     //no-go
     $telerik.$("<%=btnClear.ClientID %>").click(function (e) {
           e.preventDefault();
           PartsWasherDetails.clear();
       });

Here's the rest.

var PartsWasherDetails = function(){
   var pws
   ,settings = {
       context: "RadPanelBarAssetInfo"
   }
   , init = function () {

       pws = {
           saveButton: $telerik.$("<%=btnSave.ClientID %>"),
           searchButton: $telerik.$("<%=btnRSearch.ClientID %>"),
           clearButton: $telerik.$("<%=btnClear.ClientID %>"),
           searchValueTextBox: $telerik.$("<%=txtAssetNo.ClientID %>"),
           hdnBranch: $telerik.$("[id$='hdnBranch']").val(),
           hdnUserName: $telerik.$("[id$='hdnUserName']").val(),
           hdnAssetID: $telerik.$("[id$='hdnAssetID']").val(),
           hdnActvIndcr: $telerik.$("[id$='hdnActvIndcr']").val()
       };
       bindUIActions();
   }
   , bindUIActions = function () {
       //pws.clearButton.on("click", function (e) {
       //    e.preventDefault();
       //    PartsWasherDetails.clear();
       //});
       $telerik.$(pws.clearButton.id).click(function (e) {
           e.preventDefault();
           PartsWasherDetails.clear();
       });
       pws.searchButton.on("click", function (e) {
           //
           if (pws.searchValue.length) {
               if (pws.searchValue === "Type an Asset No Here" || pws.searchValue == '') {
                   e.preventDefault();
                   alert("Please enter a parts washer number to search.");
                   return;
               }
               //else {
               //    PartsWasherDetails.searchForPartsWasher(pws.assetNo);
               //}
           }
       });
       pws.saveButton.on("click", function () {
           PartsWasherDetails.savePartsWasherDetails();
       });
   }
   , getAssetNo = function () {
       return $telerik.$("<%=txtAssetNo.ClientID %>").val();
   }
   , searchForPartsWasher = function (assetNo) {
       alert("searchForPartsWasher Not Implemeneted");
   }
   , getPartsWasherDetails = function (assetNo) {
       alert("getPartsWasherDetails Not Implemeneted");
   }
   , setPartsWasherDetails = function () {
       alert("setPartsWasherDetails Not Implemeneted");
   }
   , savePartsWasherDetails = function () {
       alert("savePartsWasherDetails Not Implemeneted");
   }
   , clear = function () {
       alert("clear Not Implemeneted");
   }
   , buildPartsWasherSaveObject = function () {
       alert("buildPartsWasherSaveObject Not Implemeneted");
   }
   , disableElement = function () {
       alert("disableElement Not Implemeneted");
   }
   , enableElement = function () {
       alert("enableElement Not Implemeneted");
   }

    return{
        init: init,
        getAssetNo: getAssetNo,
        searchForPartsWasher: searchForPartsWasher,
        savePartsWasherDetails: savePartsWasherDetails,
        clear: clear
    };

}();

Thanks!!!

4

0 回答 0