Skip to content

Smart Search #139

@Nounours13

Description

@Nounours13

Hi, I've a projet where i must use smart search on datatable (many word on many column).
If anybody have the same problem, i've change the code to this (line 327)

  if($sSearch != '')
    {

      $sSearch_explode = explode(" ",$sSearch);
      foreach ($sSearch_explode as $sSearch)
        {
          $sWhere .= '(';
          for($i = 0; $i < count($mColArray); $i++)
          {
            if ($mColArray[$i]['searchable'] == 'true' && !array_key_exists($mColArray[$i]['data'], $this->add_columns))
              {
                if($this->check_cType())
                  {
                    $sWhere .= $this->select[$mColArray[$i]['data']] . " LIKE '%" . $sSearch . "%' OR ";
                  }               
                else
                  {
                    $sWhere .= $this->select[$this->columns[$i]] . " LIKE '%" . $sSearch . "%' OR ";
                  }
                
              }
           
          }
          $sWhere = substr_replace($sWhere, '', -3);
          $sWhere .= ') AND ';
        }
     
      
    }  
    


  $sWhere = substr_replace($sWhere, '', -4);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions