table doesn't refresh when using OR_WHERE

table doesn't refresh when using OR_WHERE

tkphuongtkphuong Posts: 5Questions: 3Answers: 0
edited February 2022 in Editor

Hello,

When I use the OR_WHERE function, my table doesn't refresh once an update is made. The data get updated correctly but it just doesn't show the new updated values unless the page is manually refreshed. When I replace to just WHERE function, then the table would reload just fine. I'm not sure what might have gone wrong.

Refresh normally after update:

->where( 'facility.Client', 'CSSA')

Does not refresh automatically:

->where( function ( $r ) {
$r->where( 'facility.Client', 'CSSA')
->or_where( 'facility.Client', 'CPS')
->or_where( 'facility.Client', 'CSSA-T')
->or_where( 'facility.Client', 'CPS-T');
} )

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Could you try this please:

    ->where( function ( $r ) {
      $r->where( function ( $q ) {
        $q
          ->where( 'facility.Client', 'CSSA')
          ->or_where( 'facility.Client', 'CPS')
          ->or_where( 'facility.Client', 'CSSA-T')
          ->or_where( 'facility.Client', 'CPS-T');
      });
    } )
    

    That inner where() call will cause our libraries to use nesting parenthesis which I think should address this issue.

    Allan

  • tkphuongtkphuong Posts: 5Questions: 3Answers: 0

    Thanks a lot Allan. It works and refreshes properly now.

Sign In or Register to comment.