Standalone - edit on load

Standalone - edit on load

belubelu Posts: 38Questions: 14Answers: 0

I have a table with only one row. There will never be more rows, because it is just a table for settings.
I would like to use the standalone mode with inline or bubble editing.
My goal is, that on page-load the fields are prefilled with the values from row_1 and can be edited.

What do I do wrong? Thanks in advance!

<div class="panel" data-editor-id="row_1"> <dl> <dt>Jahresstatistik:</dt> <dd> <span data-editor-field="c_settings.dashboard_show_hours_year_statistics"></span> </dd> <dt>Nicht exp anzeigen:</dt> <dd data-editor-field="c_settings.dashboard_show_total_hours_not_exported"></dd> <dt>Office:</dt> </dl> </div> </div> <!-- Grid Row Main --> <?php include 'templates/footer.php'; ?> <script> var editor; (function($){ $(document).ready(function() { editor = new $.fn.dataTable.Editor( { ajax: "datatables_php/ajax.be_settings_hours.php", onFieldError: 'focus', fields: [ { label: "Dashboard Jahresstatistik:", name: "c_settings.dashboard_show_hours_year_statistics", type: 'radio', options: [ { label: 'Ja', value: '1' }, { label: 'Nein', value: '0' } ] }, { label: "Dashboard nicht exportierte Stunden", name: "c_settings.dashboard_show_total_hours_not_exported", type: 'radio', options: [ { label: 'Ja', value: '1' }, { label: 'Nein', value: '0' } ] }, ] } ); // EO Editor Instanzierung $('[data-editor-field]').on( 'click', function (e) { editor.inline( 'row_1' ); } ); editor.field('c_settings.dashboard_show_hours_year_statistics').input().addClass('form-check-input'); editor.field('c_settings.dashboard_show_total_hours_not_exported').input().addClass('form-check-input'); } ); // EO Doc ready }(jQuery)); // </script>


  • belubelu Posts: 38Questions: 14Answers: 0

    I forgot to post the editor - php:

    // Build our Editor instance and process the data coming from _POST
    $editor = Editor::inst($db, 'client_settings as c_settings', 'id');
    $editor->where('id', 1, '=');
    // Wenn in der Taballe my_clients der Datatables Debug Mode eingeschaltet ist
    // client_id - wird nicht angezeigt, macht aber vieles einfacher, wenn vorhanden
        ->set(Field::SET_NONE) // weder beim neu erzeugen, noch beim Update schreiben - wird ja auf DB Ebene automatisch vergeben
    // Ausführen & JSON String
    $editor->process( $_POST );
  • colincolin Posts: 9,077Questions: 0Answers: 1,520

    What do I do wrong? Thanks in advance!

    That looks OK. Can you say what the problem is? What is wrong? And are you able to link to your page so we can take a look?


Sign In or Register to comment.