Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Add noDataLabel to customize "no records found" message #1458

Merged

Conversation

dansysanalyst
Copy link
Member

⚡ PowerGrid - Pull Request

Welcome and thank you for your interest in contributing to our project!. You must use this template to submit a Pull Request, or it will not be accepted.


Motivation

  • Bug fix
  • Enhancement
  • New feature
  • Breaking change

Description

This Pull Request adds the possibility to customize the no-data message ("No records found") individually in each component.

Individualized messages can be useful when having multiple PowerGrid components on the same page, and they also to provide more contextualized messages to users.

Usage:

The user may override the method noDataLabel() returning his own message.

use Illuminate\View\View;

class DishTable extends PowerGridComponent
{
    //...

    public function noDataLabel(): string|View
    {
        return 'We could not find any dish matching your search.';
    }
}

For the user's convenience, the method may also return a View.

use Illuminate\View\View;

class DishTable extends PowerGridComponent
{
    //...
    public function noDataLabel(): string|View
    {
        return view('dishes.no-data');
    }
}

I will provide a PR in PowerGrid's documentation once the implementation is approved.

Related Issue(s): #_____.

Documentation

This PR requires Documentation update?

  • Yes
  • No
  • I have already submitted a Documentation pull request.

@dansysanalyst dansysanalyst changed the title [FEATURE] Add noDataLabel to customize "no data" message [FEATURE] Add noDataLabel to customize "no records found" message Mar 11, 2024
@luanfreitasdev luanfreitasdev merged commit 3b8d52e into Power-Components:5.x Apr 29, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants