   $wrapper = $table.closest('.dataTables_wrapper')
   $wrapper.removeClass('effective-datatables-inline-expanded') if $wrapper.find('.effective-datatables-inline-row').length == 0
 
+refreshDatatables = ($source) ->
+  return unless EffectiveForm.remote_form_refresh_datatables.length > 0
+
+  $('table.dataTable.initialized').each ->
+    $table = $(this)
+
+    if EffectiveForm.remote_form_refresh_datatables.find((id) -> $table.attr('id').startsWith(id) || id == 'all') && $table != $except
+      if $table != $source
+        console.log("Refreshing #{$table}")
+        $table.DataTable().draw()
+
 # Cancel button clicked. Blow away new tr, or restore edit tr
 # No data will have changed at this point
 $(document).on 'click', ".dataTables_wrapper a[data-role='inline-form-cancel']", (event) ->


  EffectiveForm.remote_form_payload = ''
  EffectiveForm.remote_form_flash = ''
  true

# Submitting an inline datatables form


  EffectiveForm.remote_form_payload = ''
  EffectiveForm.remote_form_flash = ''
  EffectiveForm.remote_form_refresh_datatables = ''
  true

# There was an error completing something
