Giter Site home page Giter Site logo

Button required about alpaca HOT 6 OPEN

gitana avatar gitana commented on July 16, 2024
Button required

from alpaca.

Comments (6)

uzquiano avatar uzquiano commented on July 16, 2024

Hi there,

If your goal is add a custom button into the rendered Alpaca output, you might consider using a template. This is one way to really control the HTML that gets generated.

Here is an example of a custom layout:
http://www.alpacajs.org/examples/components/layouts/two-column-layout.html

If you did that, you could then use the postRender handler to get the rendered control.
Here's an example of postRender:
http://www.alpacajs.org/examples/components/callbacks/callback-examples.html

I suspect you could do something like:

$(function() {
    $("#field1").alpaca({
        ...
        "postRender": function(control) {
            $(control.getEl()).find(".myButtonClass").click(function(e) {
               alert("Can't match my hustle");
            });
        }
    });
});

Does that make any sense? Perhaps that's the kind of thing you're looking for.

If, on the other hand, you're asking about building a custom field control to implement a button, you can do that too. It'd involved extending one of the Field implementations that Alpaca provides. Definitely worth digging into the source to see how they're implemented. You could probably take one and adjust it.

Let me know if this helps or if you have any follow up questions.

from alpaca.

mteichtahl avatar mteichtahl commented on July 16, 2024

thanks michael

the template solution is not really what Im looking for so Ill pass on that. However, the idea of extending an existing field would be perfect, but outside my skill set. Would there be any chance of this being set as a feature request on short notice ?

Marc Teichtahl
http://www.teichtahl.com
@mteichtahl

On Tuesday, 9 July 2013 at 2:38 PM, Michael Uzquiano wrote:

Hi there,
If your goal is add a custom button into the rendered Alpaca output, you might consider using a template. This is one way to really control the HTML that gets generated.
Here is an example of a custom layout:
http://www.alpacajs.org/examples/components/layouts/two-column-layout.html
If you did that, you could then use the postRender handler to get the rendered control.
Here's an example of postRender:
http://www.alpacajs.org/examples/components/callbacks/callback-examples.html
I suspect you could do something like:
$(function() {
$("#field1").alpaca({
...
"postRender": function(control) {
$(control.getEl()).find(".myButtonClass").click(function(e) {
alert("Can't match my hustle");
});
}
});
});
Does that make any sense? Perhaps that's the kind of thing you're looking for.
If, on the other hand, you're asking about building a custom field control to implement a button, you can do that too. It'd involved extending one of the Field implementations that Alpaca provides. Definitely worth digging into the source to see how they're implemented. You could probably take one and adjust it.
Let me know if this helps or if you have any follow up questions.


Reply to this email directly or view it on GitHub (#63 (comment)).

from alpaca.

uzquiano avatar uzquiano commented on July 16, 2024

No problem.

We can probably knock something like this out as a quick consulting engagement. Nothing too expensive and it shouldn't take too long. The main idea would be to understand your requirements in full, iterate on the code and make sure you're happy.

If we're able to then contribute that code back to the community, all the better. I'm sure there are others who would like to have custom drop in buttons without coding them into an HTML form or writing the callback handlers by hand.

from alpaca.

hardikkaji avatar hardikkaji commented on July 16, 2024

Dear @uzquiano,

Hey you worked out something for this issue?
I have same requirement as @mteichtahl.!

Kindly do needful..

Thanks in advance.

Regards,
Hardik Kaji

from alpaca.

yrojha4ever avatar yrojha4ever commented on July 16, 2024

Hi @uzquiano
I am also needing button which can be used in any part of form. Is this feature available?
It would be great to have it inside alpaca.
Thanks

from alpaca.

yrojha4ever avatar yrojha4ever commented on July 16, 2024

Hi, @uzquiano
I want button as a alpaca field which I can use button in any place. Could you please make it as a feature request or please provide little more information on extending it. I will do that task and will let you know.
Thanks

from alpaca.

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.