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

Custom view prepend #1036

Closed

Conversation

SimonMacIntyre
Copy link
Contributor

@SimonMacIntyre SimonMacIntyre commented Feb 1, 2023

The currently existing customView is only suitable for modals and things at the bottom of the page. I really needed something like this as well so that I can do what I have shown in the video comment I added below.

I would propose renaming customView to customViewAppend but not worth breaking changes obviously.

All Submissions:

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests and did you add any new tests needed for your feature?
  2. Did you update all templates (if applicable)?
  3. Did you add the relevant documentation (if applicable)?
  4. Did you test locally to make sure your feature works as intended?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@SimonMacIntyre
Copy link
Contributor Author

Example of the feature this unlocks:

Screen.Recording.2023-02-01.at.11.17.59.AM.mov

@SimonMacIntyre
Copy link
Contributor Author

I was not aware of before-toolbar, and now I am unsure if this is different at all. This was just after I was looking at Custom View in isolation, and wondering why an after block existed but not a before, so I made this. So I am not sure if before-toolbar is the exact same functionally as this, or if this offers anything new at all.

@lrljoe
Copy link
Collaborator

lrljoe commented Feb 1, 2023

As mentioned on the Discussion, I'd recommend adding an additional configurableArea if before-toolbar doesn't suit (which it may not due to the filter/sorting pils), over this.

@SimonMacIntyre
Copy link
Contributor Author

I was not aware of before-toolbar, and now I am unsure if this is different at all. This was just after I was looking at Custom View in isolation, and wondering why an after block existed but not a before, so I made this. So I am not sure if before-toolbar is the exact same functionally as this, or if this offers anything new at all.

After testing this, it seems there is a difference in how the loading/reaction to variable changes between this and before-toolbar.

Using my already working example, I simply commented out my customViewPrepend, and instead used

$this->setConfigurableAreas([
            'before-toolbar' => 'data-table-error'
        ]);

But what was interesting, is it did not seem to reload or pick up the variable change and thus show, so it never shows.
I'm sure there is some way to control that, but to me this means this is different in some way. And I prefer the simplicity of my PR, if I'm being honest, which works as expected intuitively with changing variables.

I wonder if it is because my custom view prepend is a simple blade view, rather than a livewire component?

@lrljoe
Copy link
Collaborator

lrljoe commented Feb 1, 2023

Try using $this->variableName instead, and I imagine it'll work smoothly. Or entangle it with alpine and do it that way.

I built something very similar for displaying the download links for Exports, but using the before-toolbar area.

@SimonMacIntyre
Copy link
Contributor Author

Try using $this->variableName instead, and I imagine it'll work smoothly. Or entangle it with alpine and do it that way.

I built something very similar for displaying the download links for Exports, but using the before-toolbar area.

Aha.... yes that did it.

Thanks a lot @lrljoe, appreciate you always being here to help!

@lrljoe
Copy link
Collaborator

lrljoe commented Feb 1, 2023

No problem, I'll update those docs in my next PR, and might add a pointer in there around variable access, as no doubt others have had the same issue!

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