GithubHelp home page GithubHelp logo

Comments (4)

silverbux avatar silverbux commented on August 17, 2024 1

you could add them with

bower install --save datatables.net-buttons
bower install --save datatables.net-buttons-dt

reference: https://datatables.net/download/bower

it should save the files on bower_components, and should be automatically added on the vendor.js,
if it's not loading correct files you could override settings on /tasks/bower.task.js.

your last resort would be adding it on resources/views/index.blade.php though i don't really recommend this one.

though i haven't really tried this, not really sure how angular-datatables implemented / supported extensions.

you might want to consult as well
https://github.com/l-lin/angular-datatables

from laravel-angular-admin.

ixperiencenl avatar ixperiencenl commented on August 17, 2024 1

Ha! You're a great help!
It's working perfectly.

So for anyone else that wants to use these handy features, do as @silverbux mentioned in the above post and then in your datatables instance add

.withButtons([
            'columnsToggle',
            'colvis',
            'copy',
            'print',
            'excel',
            {
                text: 'Some button',
                key: '1',
                action: function (e, dt, node, config) {
                    alert('Button activated');
                }
            }
        ])

Like described in the documentation on https://l-lin.github.io/angular-datatables/#/withButtons
There's no need to add extra arguments to the constructor of your component, works like a charm.

from laravel-angular-admin.

silverbux avatar silverbux commented on August 17, 2024

Hi, not sure if i got the question right, but if the question is where to put button functionality it should be on the controller of datatables.buttons, and im assuming you created a new component or perhaps directive datatables.buttons you have to make it a little more flexible and allow passing of parameters on it to make it reusable, check the url below regarding this

angularjs-pass-argument-to-directive

from laravel-angular-admin.

ixperiencenl avatar ixperiencenl commented on August 17, 2024

Hi Silverbux,

Thanks for the quick reply. I think there's a little hickup in the communication. I'll try to explain the situation.

I have the datatables plugin working (because it's standard in this repo, thanks for that :) ) - and it's added into index.modules.js as so:
angular.module('app.components', [
'ui.router', 'angular-loading-bar',
'restangular', 'ngStorage', 'satellizer',
'ui.bootstrap', 'chart.js', 'mm.acl', 'datatables' ])

To use it in my controller I added the 'DTOptionsBuilder, DTColumnBuilder' directives in the constructor, which is working fine.

But now I wanted to use the button functionality as well, and I added 'datatables.buttons' into the modules array. This works because the datatables.buttons is included in the angular datatables package. So far so good. But now I need to use it in the controller. So for that I just add .withButtons to my datatables instance. No errors, but no buttons either. So I read on the angular-datatables page (https://l-lin.github.io/angular-datatables/#/withButtons) that I need to include the additional JS files as well.... but now my question is, where to add this? Or do I need to include the contents of those files into the big vendor.js (root/public/js/vendor.js) file?

Hope this shows the underlying problem I have atm.

from laravel-angular-admin.

Related Issues (20)

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.