Comments (6)
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.
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.
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.
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.
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.
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)
- Dependencies no longer working after field.refresh()
- Layout/template for ArrayField items?
- format: uri does not accept an IP address HOT 1
- Multiselect order
- Add new item in Array object with multiple selected
- Plans on proceeding with broken TAG-field?
- [Ask] change helper text color
- [Ask] Accessing options of a field from another field
- How do I trigger the per-field validation chain when ANY field changes on the form?
- "too much recursion" with jQuery 3.4 using enum
- textarea data not being set properly
- Missing null checkes
- When Creating A Form Builder, How do I make the checkbox multiple select to be true as default? HOT 1
- Conditional Dependency failing
- Field is excluded in the Alpaca.getValue() when dependent on hidden field
- Unable to set uploaded images in postRender
- Repo Future? HOT 3
- After load form and the first running function in the 'events > change' in the select field the validation stops work
- Is this a bug with the "valid" and "invalid" callbacks inside a View?
- Alpaca Gitana
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alpaca.