Working example of jeditable and autocomplete working together

前端 未结 6 2263
无人共我
无人共我 2021-02-10 18:54

I see a lot of google posts on this but all seems to be talking about how this is in progress. Does anyone know of a working version of jeditable and autocomplete functionality

6条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-10 19:41

    Complete working integration of dataTable, dataTables editable (legacy), jEditable, autocomplete jQuery plugins with AJAX source and results updated at bottom on page(i.e. appended to body of html) is solved by:

    $.editable.addInputType('autocomplete', {
                element: $.editable.types.text.element,
                plugin: function(settings, original) {
                    var $row = $(this).closest('tr').prop('id');
                    settings.autocomplete.appendTo = "#results-"+$row;
                    $('input', this).autocomplete(settings.autocomplete);
                }
            });
    

    Datatable legacy editable code:

    {
      tooltip: 'Click to update Owner',
      type: 'autocomplete',
      autocomplete: {
                      serviceUrl: './search/users/by/name',
                      minChars: 5,
                      paramName: 'username',
                      dataType: 'json'
      },
      cancel : 'Cancel',
      submit : 'Submit',
    }
    

    TD in table have:

    
    

提交回复
热议问题