yajra / laravel-datatables-html

Laravel DataTables HTML Builder Plugin
https://yajrabox.com/docs/laravel-datatables/html-installation
MIT License
272 stars 61 forks source link

feat: add macro in editor builder #225

Closed yajra closed 2 months ago

yajra commented 2 months ago

Usage

        Editor::macro('focusOnOpen', function (string $field) {
            /** @var Editor $this */
            $this->onOpen("function() { $('#DTE_Field_{$field}').focus(); }");

            return $this;
        });

        Editor::macro('submitOnReturn', function (string|bool $action = 'submit') {
            /** @var Editor $this */
            $this->formOptionsMain(['onReturn' => $action]);

            return $this;
        });

Use Case

                Editor::make()
                    ->ajax(route('accounts.store', $this->account))
                    ->submitOnReturn(false)
                    ->focusOnOpen('amount')
sonarcloud[bot] commented 2 months ago

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint