tochoromero / aurelia-table

Simple functional data table for Aurelia
https://tochoromero.github.com/aurelia-table
MIT License
67 stars 25 forks source link

Failed to load resource #9

Closed paulolvac closed 8 years ago

paulolvac commented 8 years ago

Hi there - thanks for a great plugin!

I'm following the instructions on https://tochoromero.github.io/aurelia-table/ but the app breaks at the moment I add ".plugin('tochoromero/aurelia-table');" to the main.js.

This is the error I get:

Failed to load resource: the server responded with a status of 404 (Not Found)
vendor-bundle.js:1399 Unhandled rejection Error: Script error for "tochoromero/aurelia-table"
http://requirejs.org/docs/errors.html#scripterror
    at Error (native)
    at F (http://localhost:9000/scripts/vendor-bundle.js:3763:290)
    at HTMLScriptElement.onScriptError (http://localhost:9000/scripts/vendor-bundle.js:3786:113)
From previous event:
    at DefaultLoader.loadModule (http://localhost:9000/scripts/vendor-bundle.js:11532:14)
    at _loadPlugin (http://localhost:9000/scripts/vendor-bundle.js:10294:21)
    at http://localhost:9000/scripts/vendor-bundle.js:10287:16
From previous event:
    at loadPlugin (http://localhost:9000/scripts/vendor-bundle.js:10286:75)
    at next (http://localhost:9000/scripts/vendor-bundle.js:10547:20)
From previous event:
    at next (http://localhost:9000/scripts/vendor-bundle.js:10547:56)
    at http://localhost:9000/scripts/vendor-bundle.js:10554:16
From previous event:
    at FrameworkConfiguration.apply (http://localhost:9000/scripts/vendor-bundle.js:10539:44)
    at Aurelia.start (http://localhost:9000/scripts/vendor-bundle.js:10156:23)
    at Object.configure (http://localhost:9000/scripts/app-bundle.js:138:13)
    at http://localhost:9000/scripts/vendor-bundle.js:9250:29
From previous event:
    at config (http://localhost:9000/scripts/vendor-bundle.js:9249:48)
    at handleApp (http://localhost:9000/scripts/vendor-bundle.js:9240:12)
    at http://localhost:9000/scripts/vendor-bundle.js:9269:13
From previous event:
    at http://localhost:9000/scripts/vendor-bundle.js:9267:40
From previous event:
    at http://localhost:9000/scripts/vendor-bundle.js:9266:29
From previous event:
    at run (http://localhost:9000/scripts/vendor-bundle.js:9262:26)
    at Object.<anonymous> (http://localhost:9000/scripts/vendor-bundle.js:9289:3)
    at Object.execCb (http://localhost:9000/scripts/vendor-bundle.js:3785:299)
    at Object.check (http://localhost:9000/scripts/vendor-bundle.js:3774:50)
    at Object.enable (http://localhost:9000/scripts/vendor-bundle.js:3779:58)
    at Object.enable (http://localhost:9000/scripts/vendor-bundle.js:3783:433)
    at Object.<anonymous> (http://localhost:9000/scripts/vendor-bundle.js:3778:436)
    at http://localhost:9000/scripts/vendor-bundle.js:3763:140
    at y (http://localhost:9000/scripts/vendor-bundle.js:3762:207)
    at Object.enable (http://localhost:9000/scripts/vendor-bundle.js:3777:469)
    at Object.init (http://localhost:9000/scripts/vendor-bundle.js:3772:154)
    at http://localhost:9000/scripts/vendor-bundle.js:3782:308

Am I doing something wrong?

tochoromero commented 8 years ago

This seems to be an error with your bundles. How are you adding the aurelia table to your bundle? You should have something like this:

'tochoromero/aurelia-table',
'tochoromero/aurelia-table/*.html!text'

This will ensure you also include the html files in your bundle.

paulolvac commented 8 years ago

do you mean config.js?

tochoromero commented 8 years ago

Well, the error references vendor-bundle.js. So, how are you running the app, are you using gulp watch?

paulolvac commented 8 years ago

au run --watch

tochoromero commented 8 years ago

Ah, so you are using Aurelia CLI. I have never used it, so I haven't tested my app there. Do you know if the CLI tries to bundle the app before running it?

paulolvac commented 8 years ago

Yes - the vendor-bundle.js is generated before running it.

tochoromero commented 8 years ago

So you need to make sure that your bundle includes the two lines I mentioned before. You need to find the configuration file that defines what classes go into your bundles and add them there.

paulolvac commented 8 years ago

Still trying to find it... very divergent documentation about Aurelia online! It's confusing.

ben-girardet commented 8 years ago

Hi there. I've been trying to configure aurelia-table in a project built with aurelia-cli and ran into the exact same problem. Would love to find out how to properly configure the importing of aurelia-table as this plugin seems brillant and very useful !

ben-girardet commented 8 years ago

@paulolvac I've finally found how to properly include this plugin when using aurelia-cli. You need to

npm install tochoromero/aurelia-table --save

and then write the following in your aurelia.json project file:

{
  "name": "aurelia-table",
  "path": "../node_modules/aurelia-table/dist/amd",
  "main": "index",
  "resources": [
    "au-table-pagination.html"
  ]
}

and finally include the plugin like so:

aurelia.use
    .standardConfiguration()
    .plugin('aurelia-table')
    .feature('resources');

in your main.js file.

@tochoromero I suggest this is worth adding in your documentation for people using aurelia-cli and wanting to use your plugin.

paulolvac commented 8 years ago

Now it loads but there's still a conflict with the "import {HttpClient} from 'aurelia-fetch-client';" that breaks the app. Still looking into it. Anyway, your plugin is the best I found on the web for datatables - it's awesome!

paulolvac commented 8 years ago

Never mind... looks like the cli does not come with it: http://ilikekillnerds.com/2016/08/adding-aurelia-fetch-client-aurelia-cli-project/

ben-girardet commented 8 years ago

Also I realized that this plugin has a master branch ahead of its releases and documentation. For example, the filter feature (as documented) doesn't work from the master branch. So in order to avoid this problems, I suggest to import the library with an indication of the release you want to install. I currently installed like so:

npm install tochoromero/aurelia-table#0.1.4

This will install the 0.1.4 release corresponding to the current documentation. The filter feature will work with this version.

tochoromero commented 8 years ago

@ben-girardet You are right, the master is ahead of the documentation. I just haven't had chance to update it. The search plugin is the only breaking change I have added, but it is quite easy to use.

The change was basically to get rid of the fiterText and filterKeys properties and replace them with a filters property that takes in an array of objects like this:

filters = [
      {value: '', keys: ['name', 'company']},
      {value:'', keys:['email']}
    ];

And then you bind each value to an input or select or whatever you want:

<input value.bind="filters[0].value & throttle">

And of course you set the property in the table:

<table aut-table="filters.bind: filters">
paulolvac commented 8 years ago

Everything works perfectly now! What an awesome plugin. It really WORKS - also on Aurelia CLI.

tochoromero commented 8 years ago

@ben-girardet I have done a new release that includes the multiple filters features. At this point master is up to date with the documentation

lebolo commented 7 years ago

Hi @tochoromero, thanks for such a great tool!

May I suggest adding https://github.com/tochoromero/aurelia-table/issues/9#issuecomment-246630267 (or at least a link to it) to the installation docs?

tochoromero commented 7 years ago

Sure thing, I will add it to the documentation

tochoromero commented 7 years ago

@ben-girardet I'm planning on adding the aurelia-cli installation instructions to the documentation, but I don't really understand what is going on (never used aurelia-cli). So, why is it that you need to do add the au-table-pagination.html to a resources array, and why just that one and not the rest of the html files the plugin has? Thanks a lot

ben-girardet commented 7 years ago

@tochoromero from my understanding aurelia-cli can find the javascript files once you provide the entry point to the plugin. It doesn't always work (depending on plugins and how the imports are done). However it cannot load the other resources such as .css and .html files, therefore you must add them to the resources of the plugin. In my case, when I tried to use your plugin without this resource indicated in aurelia.json I would get an error telling me it doesn't find the au-table-pagination.html template file. Once added everything works correctly.

I didn't see other .html files in your plugin. What other files are you talking about ?

tochoromero commented 7 years ago

Ah you are right, there no other html files, my bad, it makes sense now, thank you for the clarification, adding to the documentation.

tochoromero commented 7 years ago

Done, documentation added :)

lebolo commented 7 years ago

Thanks @tochoromero, sorry to be annoying, but for me it had to be .plugin('aurelia-table') and not .plugin('tochoromero/aurelia-table') as mentioned in your docs =)

tochoromero commented 7 years ago

Thanks @lebolo I have fixed it :)

paulolvac commented 7 years ago

Hector Romero, first of all, thanks for a great plugin. We talked about it some months ago, and we use Aurelia Table a lot here – if only it were for public websites…

Do you know a way we can filter only absolute values? For instance, if I type in “3” in a filter, I get 3, 13, 33, 39, 300… that makes sense, but we have a situation where it should only return the absolute value – in this case, 3.

So by typing 3, only results with ID=3 should appear. By Typing 29, only ID=29 (and not 290 for instance) and so on.

Any ideas on how this can be achieved?

Thank you!

Paulo

From: Hector Romero [mailto:notifications@github.com] Sent: Monday, November 14, 2016 1:20 PM To: tochoromero/aurelia-table aurelia-table@noreply.github.com Cc: Paulo Vinicius paulo@lvac.com; State change state_change@noreply.github.com Subject: Re: [tochoromero/aurelia-table] Failed to load resource (#9)

Thanks @lebolohttps://github.com/lebolo I have fixed it :)

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHubhttps://github.com/tochoromero/aurelia-table/issues/9#issuecomment-260466028, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AT2yV7l7niSg1cD1hSvIO5odg8RK0DbOks5q-NCEgaJpZM4J60qZ.

tochoromero commented 7 years ago

Hello @paulolvac It is funny you mentioned this because it I just had the same need.

The way how I will solve this will be with an exact flag in the filters, so it would look like this:

filters = [
    {value: '', keys: ['name'], exact: true}

Beware that with this new option the filter will become case sensitive.

I will implement this new feature in the next couple of days. If you need it right now you can always use a custom filter. There is one example in the documentation.

Also, would you mind to create a new Issue for this specific feature?

Cheers. Hector Romero

paulolvac commented 7 years ago

Thank you Hector,

It didn’t seem to work… I still get 33 when I type 3. I saw the custom filter but couldn’t find a way to make it work exactly like this.

Sure, I will create it. I’ve never done this but I’ll give it a try!

Thank you so much,

Paulo

From: Hector Romero [mailto:notifications@github.com] Sent: Tuesday, May 23, 2017 8:48 AM To: tochoromero/aurelia-table aurelia-table@noreply.github.com Cc: Paulo Vinicius paulo@lvac.com; Mention mention@noreply.github.com Subject: Re: [tochoromero/aurelia-table] Failed to load resource (#9)

Hello @paulolvachttps://github.com/paulolvac It is funny you mentioned this because it I just had the same need.

The way how I will solve this will be with an exact flag in the filters, so it would look like this:

filters = [

{value: '', keys: ['name'], exact: true}

Beware that with this new option the filter will become case sensitive.

I will implement this new feature in the next couple of days. If you need it right now you can always use a custom filter. There is one example in the documentation.

Also, would you mind to create a new Issue for this specific feature?

Cheers. Hector Romero

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/tochoromero/aurelia-table/issues/9#issuecomment-303441907, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AT2yV7GW7EoJEN6yGNEbSlXkZb_GTou-ks5r8v-2gaJpZM4J60qZ.

tochoromero commented 7 years ago

Actually, I already created the issue a couple of days ago, I forgot I had created it

https://github.com/tochoromero/aurelia-table/issues/35

I will work on it as soon I have a chance

paulolvac commented 7 years ago

Thank you Hector – I think this feature will be perfect.

Still learning the ropes with Aurelia…

From: Hector Romero [mailto:notifications@github.com] Sent: Tuesday, May 23, 2017 9:00 AM To: tochoromero/aurelia-table aurelia-table@noreply.github.com Cc: Paulo Vinicius paulo@lvac.com; Mention mention@noreply.github.com Subject: Re: [tochoromero/aurelia-table] Failed to load resource (#9)

Actually, I already created the issue a couple of days ago, I forgot I had created it

35https://github.com/tochoromero/aurelia-table/issues/35

I will work on it as soon I have a chance

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/tochoromero/aurelia-table/issues/9#issuecomment-303446583, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AT2yV7DqzIXzOnV-B09IhR6LCDhbrFMRks5r8wKOgaJpZM4J60qZ.

paulolvac commented 7 years ago

Hector,

Just to let you know that this custom filter worked like a charm:

customFilterExactMatch(filterValue, row) { return row.rowyouwanttofilter == filterValue; }

Again, thanks for delivering this great plugin! Is there a testimonial area in one of your sites where I can post a five-star testimony? :)

Paulo

From: Hector Romero [mailto:notifications@github.com] Sent: Tuesday, May 23, 2017 8:48 AM To: tochoromero/aurelia-table aurelia-table@noreply.github.com Cc: Paulo Vinicius paulo@lvac.com; Mention mention@noreply.github.com Subject: Re: [tochoromero/aurelia-table] Failed to load resource (#9)

Hello @paulolvachttps://github.com/paulolvac It is funny you mentioned this because it I just had the same need.

The way how I will solve this will be with an exact flag in the filters, so it would look like this:

filters = [

{value: '', keys: ['name'], exact: true}

Beware that with this new option the filter will become case sensitive.

I will implement this new feature in the next couple of days. If you need it right now you can always use a custom filter. There is one example in the documentation.

Also, would you mind to create a new Issue for this specific feature?

Cheers. Hector Romero

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/tochoromero/aurelia-table/issues/9#issuecomment-303441907, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AT2yV7GW7EoJEN6yGNEbSlXkZb_GTou-ks5r8v-2gaJpZM4J60qZ.

tochoromero commented 7 years ago

@paulolvac I'm glad you figured it out. And no, I don't have anywhere for testimonials, but a star in the GitHub project would be appreciated :)

paulolvac commented 7 years ago

Sure – starred right now!

From: Hector Romero [mailto:notifications@github.com] Sent: Wednesday, May 24, 2017 9:44 AM To: tochoromero/aurelia-table aurelia-table@noreply.github.com Cc: Paulo Vinicius paulo@lvac.com; Mention mention@noreply.github.com Subject: Re: [tochoromero/aurelia-table] Failed to load resource (#9)

@paulolvachttps://github.com/paulolvac I'm glad you figured it out. And no, I don't have anywhere for testimonials, but a star in the GitHub project would be appreciated :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/tochoromero/aurelia-table/issues/9#issuecomment-303782515, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AT2yV-sE8YD8cAH1tWb_A0uAihNRQpu3ks5r9F5sgaJpZM4J60qZ.

raskolnikoov commented 7 years ago

See this issue #38