vendredi 26 octobre 2018

How to exclude unwanted params from json object in rails 3.2

This is my url for ajax

def get_dataset

@reportdata = ReportAccountClose.where('ClosingType is not null')
@reporthp = @reportdata.map{|l| l.hp_entry}
x = {   data:@reportdata + @reporthp }         
render json: x
end

And My view for rendering datatable is

<script type="text/javascript">
  $('#ajax-table').DataTable({
 ajax: '/get_dataset',
   columns: [
{title: 'A/C NO', data: 'HPEntryId'},
{title: 'Name', data: 'Name'},
{title: 'VEHICLE NO', data: 'VehicleNumber'},
{title: 'TYPE', data: 'ClosingType'},
  ]
});
</script>

I want to filter HPEntryId which is present in @reportdata,@reporthp objects.How can i obtain filtered json response?

Aucun commentaire:

Enregistrer un commentaire