editor work with two different database? to get options or update

editor work with two different database? to get options or update

eyal_hbeyal_hb Posts: 98Questions: 31Answers: 0

can editor work or get data from two database in same method?
i work with sqlServer and i have two different database that have data i need in same table
this can be done ?

Answers

  • allanallan Posts: 63,180Questions: 1Answers: 10,411 Site admin

    The best way of doing this is probably with a custom method to get the options for the database using whatever db connection it is that you need.

    Allan

  • eyal_hbeyal_hb Posts: 98Questions: 31Answers: 0

    OK. i have another question Allan, i try to work with the row Reorder but it isn't working. my code its like the example, i can drag but when i drop on other row its didn't fired and nothing happen! what the problem

    editor = new $.fn.dataTable.Editor({
            ajax: '@Url.Action("GetDataCategories", "Tours_Categories")',
            table: '#example',
    
            fields: [{
                label: 'Order:',
                name: 'Tours_Categories.Category_Order',
                fieldInfo: 'This field can only be edited via click and drag row reordering.'
            },
                {
    
                    name: "Tours_Categories.Category_Id",
                    type: "hidden",
                },
            ]
        });
    
    
        var table = $('#example').DataTable({
            dom: "Bfrtip",
            rowReorder: true,
            fixedHeader: true,
               ajax: '@Url.Action("GetDataCategories", "Tours_Categories")',
                "language": {
                    "processing": '<i class="fas fa-circle-notch fa-spin fa-2x fa-fw"></i><span class="loading">טוען...</span> ',
                    "lengthMenu": "הצג _MENU_ פריטים",
                    "zeroRecords": "לא נמצאו רשומות מתאימות",
                    "emptyTable": "לא נמצאו רשומות מתאימות",
                    "info": "_START_ עד _END_ מתוך _TOTAL_ רשומות",
                    "infoEmpty": "0 עד 0 מתוך 0 רשומות",
                    "infoFiltered": "(מסונן מסך _MAX_  רשומות)",
                    "infoPostFix": "",
                    "search": "חפש:",
                    "url": "",
                    "paginate": {
                        "first": "ראשון",
                        "previous": "קודם",
                        "next": "הבא",
                        "last": "אחרון"
                    },
                },
            columns: [
                    { data: "Tours_Categories.Category_Order", className: 'reorder' },
                    { data: "Tours_Categories.Category_Name"},
            ],
    
            rowReorder: {
                dataSrc: 'Tours_Categories.Category_Order',
                editor: editor
            },
            select: true,
                buttons: [
                    { extend: "create", editor: editor,text:"חדש" },
                    { extend: "edit", editor: editor, text: "עריכה" },
                    {
                        extend: "selected",
                        text: 'שכפול שורה',
                        className: "buttons-edit",
                        action: function (e, dt, node, config) {
                            // Start in edit mode, and then change to create
    
                            editor
                                .edit(table.rows({ selected: true }).indexes(), {
                                    title: 'שכפול שורה',
                                    buttons: 'שמירה',
    
                                })
                                .mode('create');
    
    
                        }
                    },
                    { extend: "remove", editor: editor, text: "מחיקה" }
            ]
        });
    
  • allanallan Posts: 63,180Questions: 1Answers: 10,411 Site admin

    I don't immediately see what would be causing a problem there I'm afraid. Could you link me to your page so I can debug it please.

    Allan

This discussion has been closed.