Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Ux Datatable Laravel Package

aziz403/ux-datatable

View on GitHub
Deep Wiki
Context7

Example of using global_controller

In this is example we will use global_controller to render a custom theme.

Step 1 : Create Stimulus Controller

Of course the first step is create the controller, and also we need to relate it with our main datatable controller, how ? its easy like that:

// myglobal-datatable_controller.js

import { Controller } from '[@hotwired](https://github.com/hotwired)/stimulus';
import $ from 'jquery';
import "myglobal_datatable.css"; // Use your datatable custom style

export default class extends Controller {
    connect() {
        this.element.addEventListener('datatable:before-connect', this._onPreConnect);
        this.element.addEventListener('datatable:connect', this._onConnect);
    }

    disconnect() {
        // You should always remove listeners when the controller is disconnected to avoid side effects
        this.element.removeEventListener('datatable:before-connect', this._onPreConnect);
        this.element.removeEventListener('datatable:connect', this._onConnect);
    }

    _onPreConnect(event) {
        // The datatable is not yet created
        // You can access the datatable options using the event details
        event.detail.options['dom'] = "<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'<'float-right destination-datatable-buttons-container'>>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>";
    }

    _onConnect(event) {
        // The datatable was just created
        // use global search input
        let globalSearchBar = $('input.global-search-bar');
        globalSearchBar.keyup(function(){
            // You can access the datatable instance using the event details
            event.detail.table.search($(this).val()).draw();
        })
    }
}

Step 2 : Use Stimulus Controller In Config

Set controller in config

//config/packages/datatable.yaml
datatable:
  global_controller: 'myglobal-datatable'
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings