Sunday, December 9, 2018

Performing a search in a segment using with textbox

//call this function in ontextchange event of textbox
function search(){
  try{

    if(frmCountryCodeList.txtSearch.text !== ""){

      var searchArr = [];

      for(var i = 0; i<gbl_country_code.length; i++){
        if(gbl_country_code[i].lblCountry.toLowerCase().includes(frmCountryCodeList.txtSearch.text.toLowerCase())){
          searchArr.push(gbl_country_code[i]);
        }
      }
      frmCountryCodeList.segCountryCode.setData(searchArr);

    }else{
      frmCountryCodeList.segCountryCode.setData(gbl_country_code);
    }


  }catch(err){
    dialogue("Err "+err);
  }
}

No comments:

Post a Comment