Java spring MVC Application

Java spring MVC Application

skaziskazi Posts: 7Questions: 3Answers: 0
edited October 2017 in Free community support

Hi,
I am using JAVA Spring MVC for backend, Angular and JSP for frontend to create an application to display all of Database data in a table with sorting, pagination, searching functionality and also Edit and Delete functionality. My question is When user hits the edit button and edits the content, how do I post that to the backend db? Is there any examples I can follow?

Answers

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin

    What are you using to display the editing view?

  • skaziskazi Posts: 7Questions: 3Answers: 0

    Hi Allan I am using Jquery datatables for the editting view.

  • skaziskazi Posts: 7Questions: 3Answers: 0

    Please find the code below:

    $(document).ready(function() {
    editor = new $.fn.dataTable.Editor( {
    table: "#myTable",
    idSrc: 'intakeid',
    fields: [ {
    label: "Intake ID:",
    name: "intakeid"
    }, {
    label: "Status:",
    name: "status"
    }, {
    label: "Requester:",
    name: "requester"
    }, {
    label: "Create date:",
    name: "createdate"
    }, {
    label: "Target date:",
    name: "targetdate"
    }, {
    label: "Intake Type:",
    name: "intaketype"
    }, {
    label: "Request Team",
    name: "requestteam"
    }, {
    label: "Notify Email",
    name: "notifyemail"
    }, {
    label: "Comments",
    name: "comments"
    }
    ]
    } );

    var table = $('#myTable').DataTable( {
        dom: "Bfrtip",
        "iDisplayLength": 15,
        "lengthChange": false,
        "ordering": false,
        "info":     false,
        'columnDefs': [
         {
            'targets': 1,
            'orderable': false,
            'checkboxes': {
               'selectRow': true
            }
         }
          ],
          'select': {
             'style': 'multi'
          },
    
        columns: [
            { data: null, render: function ( data, type, row ) {
                // Combine the first and last names into a single table field
                return '';
            } },
            { data: "intakeid" },
            { data: "status" },
            { data: "requester" },
            { data: "createdate" },
            { data: "targetdate" },
            { data: "intaketype" },
            { data: "requesteam" },
            { data: "email" },
            { data: "comments", render: $.fn.dataTable.render.number( ',', '.', 0, '$' ) }
        ],
        select: true,
        buttons: [
            'selectAll',
            'selectNone',
    
            { extend: "create", editor: editor },
            { extend: "edit",   editor: editor },
            {
                extend: "selectedSingle",
                action: function ( e, dt, node, config ) {
                    // Immediately add `250` to the value of the salary and submit
                    editor
                        .edit( table.row( { selected: true } ).index(), false )
                        .submit();
                }
            },
            { extend: "remove", editor: editor }
        ]
    });
    
    $('#min,#max').datepicker({
        format: "mm/dd/yyyy",
        weekStart: 1,
        daysOfWeekHighlighted: "0",
        autoclose: true,
        todayHighlight: true
    });
    
    // Add event listeners to the two range filtering inputs
    $('#min,#max').change(function(){ table.draw(); });
    

    });

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin

    You need to add the ajax option to the Editor configuration to tell it where to send the data. An example of that is available here.

    The manual details the client / server parameters that Editor uses.

    Regards,
    Allan

  • skaziskazi Posts: 7Questions: 3Answers: 0

    Hi Allan,
    Does the editor license needs to be renewed every time or it's a one time purchase? Also, is it possible to extend the trial time? I am still trying to get it to work..

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin

    One time purchase. All v1.x releases of the software are included in the license.

    And yes, absolutely no problem to extend the trial - I've just done that for your account and a fresh trial can be downloaded from the following address when logged in with your account.

    Only the dataTables.editor.js and dataTables.editor.min.js files need to be updated in your current install from the updated trial package. You may need to clear your browser's cache to make sure the updated files are picked up.

    Regards,
    Allan

This discussion has been closed.