problem edit

problem edit

alejandrodejuanalejandrodejuan Posts: 5Questions: 0Answers: 0

good, we are doing tests with the editor to see if it is good for our company and we have a problem when editing, to create it works well but when editing in the mvc part the action is not coming to edit but the data reaches 0, could you tell us what the problem is?

    var editor;

    $(document).ready(function () {
        editor = new $.fn.dataTable.Editor({
            table: "#datatable",
            ajax: {
                create: {
                    type: 'POST',
                    url: 'http://localhost:55218/task/config/add',
                },
                edit: {
                    type: 'POST',
                    url: 'http://localhost:55218/task/config/edit',
                },
                delete: {
                    type: 'POST',
                    url: 'http://localhost:55218/task/config/delete',
                }
            },
            idSrc: 'codconfig',
            fields: [
                {
                    label: "codconfig:",
                    name: "codconfig"
                },
                {
                    label: "Key:",
                    name: "key"
                },
                {
                    label: "Value:",
                    name: "value"
                }]
        });

        $('#datatable').DataTable({
            dom: "Bfrtip",
            ajax: {
                url: "http://localhost:55218/task/config/list",
                type: "GET"
            },
            serverSide: true,
            columns: [
                { data: "codconfig" },
                { data: "key" },
                { data: "value" },
            ],
            select: true,
            buttons: [
                { extend: "create", editor: editor },
                { extend: "edit", editor: editor },
                { extend: "remove", editor: editor }
            ]
        });
    });

Replies

  • allanallan Posts: 62,315Questions: 1Answers: 10,225 Site admin

    I'm not sure what you mean by reaches 0 I'm afraid. Could you clarify that point for me?

    Thanks,
    Allan

  • alejandrodejuanalejandrodejuan Posts: 5Questions: 0Answers: 0
    edited January 2018


    good, I tell you, when we die by ajax when adding we create this object (Caputa.png) and create edit (Captura2.png)

    but in the controller when adding we get the data well but when editing I do not attach the two captures

  • allanallan Posts: 62,315Questions: 1Answers: 10,225 Site admin

    The 0 is because Editor supports multiple rows being created at the same time. In this case you are only creating a single row, so only one object is added to the array. If you had two, it would show 0 and 1.

    Full details for that are here.

    Allan

  • alejandrodejuanalejandrodejuan Posts: 5Questions: 0Answers: 0

    Good, if I understand that the editor can create several but is giving me 0 because none is coming, I would have to give a matrix of 1 at least, the matrix comes to me empty is the problem

  • allanallan Posts: 62,315Questions: 1Answers: 10,225 Site admin

    That's odd. Can you give me a link to the page showing the issue please? I'm not sure why that would be.

    Allan

  • alejandrodejuanalejandrodejuan Posts: 5Questions: 0Answers: 0

    Good, I send the program to you in a solution since we do not have it uploaded to production, I hope you can help us since we are a company and we are looking for a control of this type and for what we have seen this editor we like

  • alejandrodejuanalejandrodejuan Posts: 5Questions: 0Answers: 0

    Hi, could you tell me something about this problem? Thank you

This discussion has been closed.