Code Monkey home page Code Monkey logo

Comments (8)

lorenzofox3 avatar lorenzofox3 commented on May 18, 2024

Hello,
I don' know what you exactly mean by "extend". But any directive inside the smart-table directive can access the table API, it means :
-the built in directives that you can modify if you want (in Directives.js)
-any directive you associate to a cell template (using cellTemplateUrl property for example)
If you want a running example, you can go on the demo site.

Please note on the custom.js tab

  1. the require: '^smartTable' which means that the directive expect to find in its parent element the directive smartTable (
  2. the link function has a parameter ctrl wich is a reference to the table controller.

for more information about directive controller you can see the documentation

cheers,

Laurent

from smart-table.

ojhughes avatar ojhughes commented on May 18, 2024

Thanks, when I add a new directive to Directives.js with require: ^smartTable i get an error saying cant find smartTable controller

from smart-table.

lorenzofox3 avatar lorenzofox3 commented on May 18, 2024

because your directive must have a parent elment in the markup wich has the 'smart-table' directive.

So it must be either one the directives you see in the table template, or one you will insert thanks to the cellTemplateUrl of your column config.

I suggest you watch [https://github.com/lorenzofox3/Smart-Table/blob/master/smart-table-module/partials/smartTable.html](this video), this explains what is a directive controller

Laurent

from smart-table.

ojhughes avatar ojhughes commented on May 18, 2024

Ah I understand now, thanks. Apologies I am very new to angular and still getting my head around directives.

from smart-table.

lorenzofox3 avatar lorenzofox3 commented on May 18, 2024

no problem

from smart-table.

morgs32 avatar morgs32 commented on May 18, 2024

Hi @lorenzofox3 I'd love to access the ctrl in the smartTableDataCell directive (which I'm trying to customize). But it comes up undefined. Probably an obvious thing I don't understand??
Thanks.

from smart-table.

lorenzofox3 avatar lorenzofox3 commented on May 18, 2024

Hi,
As mentioned on the developer guide, you have to ask for it in your directive using the require property :

return {
                require: '^smartTable',
                link: function (scope, element, attr, ctrl) { 
                }
};

Laurent

from smart-table.

morgs32 avatar morgs32 commented on May 18, 2024

Ahh. Thanks a ton. I'm getting a kick out of forking your project. Learning a lot from it.

from smart-table.

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.