GithubHelp home page GithubHelp logo

alpinejs-select's People

Contributors

presleyd avatar uwaiscode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alpinejs-select's Issues

HOWTO install

Hi,

I'm new to Alpine.

Where do I put the blade?

I tried running php artisan livewire:make RandomComponent and it seems the default locations for x-directives doesn't work.

The actual error I'm getting

Unable to locate a class or view for component [select-search].

Please help a noob.

Data problem

Hi presleyd, I'm trying to use this component but when sending the data it doesn't display correctly, do you have any idea what the problem is?

Does not work in Jetstream Modal

Thank you very much first of all for the very helpful tool.

Unfortunately, when I try to display it in a modal, it does not work.

What could be the reason for that?

multiple

Thank you, this is amazing and exactly what I've been looking for.

I have come across one problem when using multiple I see this error

app.js:647 Uncaught TypeError: items.forEach is not a function
    at handleForDirective (app.js:647)
    at app.js:1837
    at Array.forEach (<anonymous>)
    at Component.resolveBoundAttributes (app.js:1797)
    at Component.initializeElement (app.js:1722)
    at app.js:1706
    at app.js:1696
    at walk (app.js:184)
    at walk (app.js:188)
    at walk (app.js:188)

This is my view:

<x-select-search :data="$contacts->mapWithKeys(function ($item) { return [$item['id'] => $item['full_name']]; })" wire:model="contactId" multiple />

this is my

my class:

<?php

namespace App\Http\Livewire;

use Illuminate\Contracts\View\View;
use Modules\Contacts\Models\Contact;

class Dashboard extends Base
{
    public string $contactId = '';

    public function render(): View
    {
        $contacts = Contact::get();

        return view('livewire.dashboard', compact('contacts'));
    }
}

Can't find variable: AlpineSelect

This looks fantastic! While attempting to integrate it was getting errors about the data prop so I created a new Laravel component using

php artisan make:component SelectSearch

So that the SelectSearch.php component file is created:

`
namespace App\View\Components;

use Illuminate\View\Component;

class SelectSearch extends Component
{
public $data;

public function __construct($data)
{
    $this->data = $data;
}

public function render()
{
    return view('components.select-search');
}

}
`

Once this was done I was able to render the component but now the console comes back with:

Can't find variable: AlpineSelect

I'm assuming I wasn't supposed to create the component that way... thoughts on what I missed?

Thanks!

Add to Readme.md

You should add to the readme on how to use a collection.

:data="$users->mapWithKeys(function ($item) { return [$item['id'] => $item['name']]; })"

Update select live. Help me!

@presleyd Hello!

I'm sorry to have to distract you from your daily important business, but I'm completely desperate to solve my problem.

I use several AlpineSelect on the page. After selecting in the first one, I try to update the list of options in the second one. I am successfully updating the data array using the livewire component, but they are not updated for my second Select.

The problem has something to do with selected. I get the feeling that they are in conflict.

If you have an understanding of why this is happening, please help.

ScreenRecorderProject109

Alpine Expression Error

Hi when I need to add two or more select components I get an error. Is it possible to add more select components to the site?

app.js:1666 Uncaught TypeError: Cannot read properties of null (reading 'length')

Onchange

How can you use onchange event with is ? something like this
<x-list :data="$clients" @change="assignValue($event.target.value)" multiple/>

Last De-Select doesn't get transmitted

Hi @presleyd

I use your component as filter to search through objects.
If i select something the values get transmitted and the filter gets applied.
image

Now if i remove the selected values the new array gets also transmitted to livewire but on the last item it does not.
image

am i doing something wrong?

Best regards
Mario

Can't find variable: AlpineSelect

This looks fantastic! While attempting to integrate it was getting errors about the data prop so I created a new Laravel component using

php artisan make:component SelectSearch

So that the SelectSearch.php component file is created:

`namespace App\View\Components;

use Illuminate\View\Component;

class SelectSearch extends Component
{
public $data;

public function __construct($data)
{
    $this->data = $data;
}

public function render()
{
    return view('components.select-search');
}

}`

Once this was done I was able to render the component but now the console comes back with:

Can't find variable: AlpineSelect

I'm assuming I wasn't supposed to create the component that way... thoughts on what I missed?

Thanks!

How can i refresh the data passed to the compoenents ?

i have made a dropdown of projects with this select components, but i have an input up top that adds a projects in case you want to create a new one , so upon creation i want to refresh the data so the dropdoown would have the new project that i just created without having to refresh the page

First option in dropdown has a background attached to it even if it's not selected?

Trying to avoid using Select2, so I'm investigating this as a possible option. I'm assuming this isn't intentional and I'm doing something wrong but on my dropdowns the first item in the array is always highlighted (but not actually selected). If I select it it shows up as selected and the model data is updated but if I unselect it that first item in the list is still highlighted as though it was. Strange. I'm not super familiar with Livewire or Alpine, still trying to get to grips with them. If I change the Alpine code to have an option by default selected if it's null by default that shows up as selected in the list but again so does the first item in the list (just not as a bubble icon you can click off the input box).

Uncaught TypeError: Converting circular structure to JSON

I am trying to pass different data based on user select like
<x-select-search :data="$type == 'main' ? $mainData : $otherData" wire:model="mydata" placeholder="Select data!" /> but it showing the error

SupportAlpine.js:127 Uncaught TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
--- property 'defer' closes the circle
at JSON.stringify ()

if I didn't have to change the :data then it's working fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.