Case Intensive Search - mutltiselect prompt PDF Ispis E-mail
Ocjena: / 3
LošeOdlično 
Mustafa Bešlagić   
Utorak, 01 Rujan 2009

Rješenje Case Intensive Search od Shiva Molabantija iskoristili smo za pravljenje multiselect prompt Case Intensive Search tj. za pretragu svih podataka bez obzira na velika ili mala slova. Npr. ako u pretragu na multiselect search napisete podatak "hrv" odredite uvjet begin with i pritisnete gumb Go i dobit  ćete sve zapise koje počinju sa hrv bez obzira na velika ili mala slova.

  • Hrvatsko udruženje mladih
  • hrvatski dobrotvorni savez
  • hrVatska gradska komora
  • HRVATSKI SAVEZ SLIJEPIH

Razlika u rješenju (kao i u ostalim ovakvim rješenjima koje smo objavili na CROBICOM-u) odnosi se na pristup koji ne mijenjanja izvorne js skripte nego na override-anju funkcije unutar page-a.

Dakle kao i u izvornom Shivinom rješenju treba da pronađete dio js koji definira sWhere te unutar gfpmultiselect.js pronađete ovaj dio koda te izmjenite logiku. MI smo to uradili za vas tako da tamo gdje zelite da vam multiselect prompt ima takvo ponašanje postavite u text object ovaj dole izmjenjeni source i to je to. Ne zaboravite aktivirati Contains HTML Markup.

GFPMultiSelect.prototype.search = function()
{
 this.sWhere = "";

 if(this.matchTable.style.display == '')
 {
    if (this.searchForm.Constraint.value != "")
    {
     var sValue = null;
     switch (this.searchForm.Match.value)
     {
      case "beginsWith":
       sValue = GFPMultiSelect.SQLEscape(this.searchForm.Constraint.value) + "%";
       break;
      case "endsWith":
       sValue = "%" + GFPMultiSelect.SQLEscape(this.searchForm.Constraint.value);
       break;
      case "contains":
       sValue = "%" + GFPMultiSelect.SQLEscape(this.searchForm.Constraint.value) + "%";
       break;
      case "like":
          sValue = this.searchForm.Constraint.value;
     }

     if (sValue != null)
      // this.sWhere = this.vColumns[0] + " LIKE '" + sValue + "'";
         this.sWhere = this."UPPER("+vColumns[0]+")" + " LIKE UPPER('" + sValue + "')";
    }
 }
 else if(this.dateTable.style.display == '')
 {
    var tA = null;
    var tB = null;

    switch(GFPMultiSelect.primaryType)
    {
       case 'date':
          tA = tDTP.parse(this.searchForm.BetweenA.value, 2 | 8 | 16 | 32);
          tB = tDTP.parse(this.searchForm.BetweenB.value, 2 | 8 | 16 | 32);
          break;
       case 'time':
          tA = tDTP.parse(this.searchForm.BetweenA.value, 4);
          tB = tDTP.parse(this.searchForm.BetweenB.value, 4);
          break;
       case 'timeStamp':
          // convert
          tA = tDTP.parse(this.searchForm.BetweenA.value, 1 | 2 | 4 | 8 | 16 | 32);
          tB = tDTP.parse(this.searchForm.BetweenB.value, 1 | 2 | 4 | 16 | 32);
          //convert to data timezone
          if (this.nDisplayToDataTZOffset)
          {
             if (tA != null)
                tA.adjustTimeZoneOffset(this.nDisplayToDataTZOffset);
             if (tB != null)
                tB.adjustTimeZoneOffset(this.nDisplayToDataTZOffset);
          }
          break;
    }
   
    if(this.searchForm.BetweenA.value.length > 0 && !tA)
    {
       alert(kmsgWBInvalidInput + "\"" + this.searchForm.BetweenA.value + "\"");
       return false;
    }
   
    if(this.searchForm.BetweenB.value.length > 0 && !tB)
    {
       alert(kmsgWBInvalidInput + "\"" + this.searchForm.BetweenB.value + "\"");
       return false;
    }

    if(tA != null)
    {
       var sA = DateTimeParser.buildDateTimeClause('>', this.vColumns[0], GFPMultiSelect.primaryType, tA);

         if(sA != null)
          this.sWhere = sA;
       }

    if(tB != null)
    {
       var sA = DateTimeParser.buildDateTimeClause('<', this.vColumns[0], GFPMultiSelect.primaryType, tB);

         if(sA != null)
          this.sWhere = this.sWhere.length == 0 ? sA : (this.sWhere + ' AND ' + sA);

       }
 
 }
 else if(this.numericTable.style.display == '')
 {
     var tA = this.searchForm.BetweenNA.value;
     var tB = this.searchForm.BetweenNB.value;
    
     if(tA.length > 0)
     {
        tA = parseFloat(tA, 10);
        this.sWhere = this.vColumns[0] + ">=" + tA;
     }
    
     if(tB.length > 0)
     {
         tB = parseFloat(tB, 10);
         var clause = this.vColumns[0] + "<=" + tB;
         this.sWhere = this.sWhere.length == 0 ? clause : this.sWhere + " AND " + clause;
     }
 }
 
 this.choicesDiv.innerHTML = "";
 this.totalSpan.innerHTML = "0";
 this.totalSpan.setAttribute("total", 0);
 this.moreLink.style.display = "none";
 
 var sWhere = this.sWhere;
 if (this.sOldWhere && this.sOldWhere != "")
 {
    if (sWhere && sWhere != "")
       sWhere = " ( " + this.sOldWhere + " ) AND ( " + sWhere + " ) ";
    else
       sWhere = this.sOldWhere;
 }
 
 VTDisplayValues(this.choicesDiv, this.vColumns, this.subjectArea, 'kmsgGFPMultiSelectSearchValueTableRow', sWhere, this.timeZone, this.timeZoneOffset,
                 'scroll', this.sId, null, null, null, null, null, "idGFPMultiSelect" + this.sId);
}

 
« Prethodna   Sljedeća »