Monday, November 26, 2018

Search by WIDGET in segment

function getSearchResult(mData, searchValue) {

  if(ArrayofRequestlistseg !== null){
    var arr3 =[];
    arr3 = ArrayofRequestlistseg;
    var length = arr3.length;
    var sData = [];

    for ( i = 0; i < length; i++) {

      if (arr3[i].lblToMangerEmpId !== null || arr3[i].lblToMangerEmpId !== undefined) {

        var txt1 = "";
        if (arr3[i].lblToMangerEmpId !== null && arr3[i].lblToMangerEmpId !== undefined) {

          txt1 = arr3[i].lblToMangerEmpId;

        }
        var pattern = searchValue.text.trim().toUpperCase();

        if (txt1.toUpperCase().search(pattern) !== -1) {
          sData.push(arr3[i]);
        }
      }
    }
    if(sData.length > 0){
      frmDashboard.segmentmain.setData(sData);
    }else{
      sData = [];
      frmDashboard.segmentmain.setData(sData);
    }
  }else{
    return false;
  }
}

function refreshseg(){

  frmDashboard.txtSearchEmpID.text ="";
  if(ArrayofRequestlistseg !== null){
    var arr2 =[];
    arr2 = ArrayofRequestlistseg;
    frmDashboard.segmentmain.setData(arr2);

  }

}

0 comments:

Post a Comment