Open RaptorF2286 opened 5 years ago
Hi, I'm following the DateRange instructions and works fine, but when I use the default search field with numbers major that 31 I got an error.
this is my datatable.rb settings file:
class ReportPendingPaymentsDatatable < ApplicationDatatable extend Forwardable def_delegators :@view, :safe_join, :link_to, :current_user, :l def view_columns @view_columns ||= { id: { source: 'Payment.idpayment' }, start_date: { source: 'Payment.created_at', cond: :date_range, delimiter: '-yadcf_delim-' }, document: { source: 'Invoice.ref_student_document' }, name: { source: 'Invoice.ref_student_name' }, cell_phone: { source: 'Invoice.ref_student_cell_phone' }, payment_number: { source: 'Payment.payment_number' }, remaining: { source: 'Payment.balance' } } end private def data records.map do |record| { # example: id: record.idpayment, start_date: l(record.created_at, format: '%d/%m/%Y'), document: record.invoice.ref_student_document, name: record.invoice.ref_student_name, cell_phone: record.invoice.ref_student_cell_phone, payment_number: record.payment_number, remaining: record.balance.to_i, DT_RowId: record.idpayment } end end def get_raw_records # insert query here Payment.joins(:invoice) end end
and this is the coffee file
$(document).on 'turbolinks:load', -> report_pending_payments_datatable = $('#report_pending_payments-datatable').DataTable processing: true serverSide: true stateSave: true pagingType: "full_numbers" dom: 'lBfrtip' buttons: ['print', 'csv', 'excel'] ajax: url: $('#report_pending_payments-datatable').data('source') type: 'POST' columns: [ { data: 'id' } { data: 'start_date' } { data: 'document' } { data: 'name' } { data: 'cell_phone' } { data: 'payment_number' } { data: 'remaining' } ] if $('#report_pending_payments-datatable').length yadcf.init(report_pending_payments_datatable, ( [ column_number: 1, filter_type: "range_date" filter_match_mode: "exact" filter_container_id: 'datepicker-range-filter' date_format: 'dd/mm/yyyy' moment_date_format: 'DD/MM/YYYY' filter_delay: 500 style_class: 'ui fields' ] ), language: range: ['Desde', 'Hasta'] date: 'Seleccione fecha' )
Many thanks in advance for any help.
@RaptorF2286 How did you fix this?
Hi, I'm following the DateRange instructions and works fine, but when I use the default search field with numbers major that 31 I got an error.
this is my datatable.rb settings file:
and this is the coffee file
Many thanks in advance for any help.