Add lookup field next to button on list control

Hiya @mnikitina

I was wondering if there is anyway to add a field next to a button in the list control?

e.g.:

Hello @Jamal_Smith-Graham,

List or Library control doesn't support adding controls next to the buttons.

But you can try to add a field using jquery and direct patching HTML.

Hiya @mnikitina

Thanks, but I have no idea what you mean! :sweat_smile:

@Jamal_Smith-Graham,

I'm sorry for not providing more details.

You can add HTML content to the control using jQuery methods.

For example, if you want to add input control to the toolbar of the List or Library control, you need to:

  1. assign a CSS class to the List or Library control
  2. use the jQuery to find the element on the page and add new HTML content after the selected element. Please see the code example below.
fd.control('SPDataTable0').ready().then(function(dt) {
    //HTML content
    var input = '<div><label for="fname">First name:</label><input type="text" id="fname" name="fname"><br></div>'
    //add HTML content after the selected elements
    $( ".tochange" ).find('.fd-sp-datatable-toolbar').after(input);
});
2 Likes