article selection thru form in orderform

article selection thru form in orderform

BeMat Automatisering bvBeMat Automatisering bv Posts: 3Questions: 0Answers: 0

Description of problem:
I want to use datatables for an orderform with inline editing (I already have this working)
When the user doen't know the articlenumber, he can enter a part of the number or description and a form will popup with possible articles and more filters.
After selecting the right article, the popup will close and returns to the datatable with inline editing

Replies

  • kthorngrenkthorngren Posts: 20,309Questions: 26Answers: 4,771

    One option is to use select2.js for autocompletion. If you are using Editor there is a plugin to use.

    Kevin

  • BeMat Automatisering bvBeMat Automatisering bv Posts: 3Questions: 0Answers: 0

    Thanks Kevin. I looked at that already and it works fine with ajax but this is not exactly what I want.
    I really want a popup where the user can add extra filters.

  • kthorngrenkthorngren Posts: 20,309Questions: 26Answers: 4,771

    Are you using Editor or have you created your own inline editing?

    When the user doen't know the articlenumber, he can enter a part of the number or description

    Is this entry within a field in the table or outside the table?

    a form will popup with possible articles and more filters.

    Where does this list come from?

    Maybe you can post the code you have so we can see what you are doing.

    Kevin

  • BeMat Automatisering bvBeMat Automatisering bv Posts: 3Questions: 0Answers: 0
    edited July 2020

    The article data is on the server and there are al lot of articles (50,000+). a select is not an option.

        var editor;
        editor = new $.fn.dataTable.Editor( {
            ajax: "/GWS/dashboard/index.php/order?a=editorderregelpost"
            , table: "#orderregel"
            , fields: [
                {
                    label: "artnr:"
                    , name: "artnr"
                }
                , {
                    label: "omschr:"
                    , name: "omschr"
                }
            ]
            , formOptions: {
                inline: {
                    onBlur: 'submit',
                    submit: 'allIfChanged',
                    onFieldError: 'focus'
                }
            }
        } );
        
        var options = {
            ajax: {
                url: '/GWS/dashboard/index.php/order?a=orderregellist'
                , type: 'POST'
                , data: {
                    orderId: 1
                    , addEmpty: 1
                }
            }
            , columns: [
                { width: "60px", data: "artnr", className: "editable" },
                { width: "200px", data: "omschr", className: "editable" },
            ]
            , keys: {
                columns: '.editable'
                , keys: [ 9 ]
                , editor: editor
                , editOnFocus: true
            }
            , ordering: false
        };
    var defaults = {
                    language: {
                        lengthMenu: "Toon _MENU_ rijen per pagina"
                        , zeroRecords: "Geen gegevens"
                        , info: "Pagina _PAGE_ van _PAGES_"
                        , infoEmpty: "Geen gegevens beschikbaar"
                        , infoFiltered: "(gefilterd van _MAX_ aantal rijen)"
                    },
                    scrollY: height,
                    scrollCollapse: true,
                    order: [],
                    paging: false,
                    bFilter: false,
                    info: false
                }
    var table = $('#orderregel').DataTable( { defaults, options } );    
    
    

    Edited by Kevin:  Syntax highlighting. Details on how to highlight code using markdown can be found in this guide

  • allanallan Posts: 61,729Questions: 1Answers: 10,110 Site admin

    Do you mean you want to show a DataTable in a popup, from which the user can select the option they want - and can thus take advantage of DataTables’ filtering abilities?

    If so, that is not something that is built into Editor I’m afraid. It would be possible for you to add it using a custom field type plug-in though.

    Allan

This discussion has been closed.