title: Laravel Yajra DataTable Column Sorting not proper working
body: <p>Laravel Yajra DataTable Column Sorting not proper working. If I use -&gt;get() function in Query then DataTable sorting works fine. But I don't want to use get() function because If I have more than 100 000 records then it takes too much time so I don't want to use get() in query</p>
  <p><strong>here is my controllers code</strong></p>
  <pre><code>   $deals = Deal::orderBy('updated_at', 'desc');
  
     $searcharray = array();     
     parse_str($request-&gt;fromValues,$searcharray);
     
      if(isset($searcharray) &amp;&amp; !empty($searcharray)){
          
           if($searcharray['filtertype'] !=''){        
               $deals-&gt;where(&quot;deal_isApproved&quot;,'=',$searcharray['filtertype']);
          }
      }
  
      $detail_data = $deals;
      
      // print_r($deals);
      return Datatables::of($detail_data)
      -&gt;addColumn('action', function ($data) {
      $btn .= '&lt;a class=&quot;dropdown-item&quot; href=&quot;'.route('admin.deals.edit',$data-&gt;id).'&quot; style=&quot;color: black;&quot; onmouseover=\'this.style.background=&quot;#dee2e6&quot;\' onmouseout=\'this.style.background=&quot;none&quot;\'&gt;&lt;i class=&quot;far fa-edit text-primary&quot;&gt;&lt;/i&gt; Edit&lt;/a&gt;';
      $btn .= '&lt;a deal_id=&quot;'.$data-&gt;id.'&quot; class=&quot;dropdown-item deleteDeal&quot; href=&quot;#&quot; style=&quot;color: black;&quot; onmouseover=\'this.style.background=&quot;#dee2e6&quot;\' onmouseout=\'this.style.background=&quot;none&quot;\'&gt;&lt;i class=&quot;far fa-trash-alt text-danger&quot;&gt;&lt;/i&gt; Delete&lt;/a&gt;';
      return $btn;
      })
  
  -&gt;rawColumns(['action'])
  -&gt;make(true);
  </code></pre>
  <p><strong>here is my datatable initialize in blade file</strong></p>
  <pre><code>var dataTable = $('#example_laravel').DataTable({
      //lengthMenu: getPageLengthDatatable(),
      processing: true,
      serverSide: true,
      order: [],
      searchDelay: 500,
      &quot;scrollX&quot;: &quot;auto&quot;,
      // responsive: true,
      // // &quot;responsive&quot;: true,
      // &quot;lengthChange&quot;: false,
      // &quot;autoWidth&quot;: false,
      ajax: {
          url: '{{ route(&quot;admin.deals.filter&quot;)}}',
          type: 'post',
          headers: {
            'X-CSRF-TOKEN': $('meta[name=&quot;csrf-token&quot;]').attr('content')
        },
        data: function (data) {
              data.fromValues = $(&quot;#filterdealtype&quot;).serialize();
          },
      },
      columns: [
          {data: 'SrNo', //try with data: 'SrNo' OR data: 'id',
              render: function (data, type, row, meta) {
                  // return meta.row + meta.settings._iDisplayStart + 1;
                  return meta.row + 1;
              }, searchable: false, sortable: false
          },
          {data: 'deal_title', name: 'deal_title'},
          {data: 'deal_desc',
              render: function (data, type, row, meta) {
                  var data = decodeHTMLEntities(data);
                  var data = data.replaceAll(&quot;href=\&quot;&quot;,&quot;href=\&quot;http://&quot;);
                  return '&lt;div style=&quot;width: 340px; word-wrap: break-word;&quot;&gt;'+data+'&lt;/div&gt;';
              },
          },
          {data: 'deal_price', name: 'deal_price'},
          {data: 'deal_retail_price', name: 'deal_retail_price'},
          {data: 'deal_percent_off', name: 'deal_percent_off'},
          {data: 'deal_img',
              render: function (data, type, row, meta) {
                  if(data){
                      return '&lt;img id=&quot;myImg&quot; src=&quot;{{ asset('') }}'+data+'&quot; height=&quot;100px&quot; width=&quot;100px&quot;&gt;'; 
                  }else{
                      return ''; 
                  }
              }
          },
          {data: 'deal_start_date', name: 'deal_start_date'},
          {data: 'action', name: 'action', searchable: false, sortable: false},
      ],
  });
  </code></pre>
  <p>output I get be like below image
  <a href="https://i.stack.imgur.com/33oEV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/33oEV.jpg" alt="enter image description here" /></a></p>