Comments (7)
How would you go about setting appKeys? How does the current implementation work as far as serializing the data?
from clay.
My current implementation doesn't actually serialise any data back to the Pebble - it sends it to my server via an ajax post request, but that's not really the point. I should probably open another issue for that though - since it's a very common use case if you're working on a timeline enabled app. :-)
The way I currently handle it is by using html arrays. Consider these basic form elements:
<!-- block one -->
<input type="text" name="name[1]" value="nameValue1">
<input type="text" name="description[1]" value="descValue1">
<!-- block two -->
<input type="text" name="name[2]" value="nameValue2">
<input type="text" name="description[2]" value="descValue2">
The data would be received with an array for each of name
and description
:
name: ["nameValue1", "nameValue2"],
description: ["descValue1", "descValue2"]
I don't really know how this would apply to appKeys, etc... but it's definitely a valid use case for complex apps with multiple configurable "things".
from clay.
Interesting...
Maybe if there was a component called something like "dynamic-group" that had very similar syntax to a "section" but would have an add and remove buttons as well as the ability to re-order. The config would look something like:
{
type: 'dynamic-group',
structure: [
// Any combination of components
{
type: 'input',
appKey: 'name',
label: 'Name'
},
{
type: 'color',
appKey: 'fave_color',
'Favorite Color'
}
]
}
And would end up being serialized into something like:
{
name: ['Joe', 'Fred'],
fave_color: [0xFF0000, 0x00FF00]
}
from clay.
Yeah, something like that should do what I need it to do! :-)
from clay.
Sorry for bumping this one, but wanted to add one requests for the future dynamic-group
component: the ability to define the max and min number of items in the group. ie: if my config page allows the user to define their favorite contacts to a maximum of 10 the component should look something like:
{
type: 'dynamic-group',
min-items: 1, // this might be the value by default
max-items: 10,
structure: [
{
type: 'input',
appKey: 'name',
label: 'Name'
},
{
type: 'color',
appKey: 'fave_color',
'Favorite Color'
}
]
}
from clay.
Is this currently possible via a Clay Custom function, or is it impossible unless the package is updated to handle dynamic fields?
from clay.
@ignat980 You could achieve it with a custom component, but it will not be trivial. Sorry.
from clay.
Related Issues (20)
- Persist config elements' state without message Key HOT 1
- Multiline text HOT 2
- Date Time Picker HOT 3
- Cancel/Discard changes button HOT 2
- provide a URL to open in device browser HOT 1
- HRM capability needed ! HOT 2
- capabilities works fine on the emulator, kills the rest of the page on a real watch HOT 4
- Support for accessing camera! HOT 1
- Ambiguous use of app.js on CloudPebble HOT 6
- how do pebble c to get checkboxgroup value HOT 1
- Set CSS style of element HOT 1
- Option of not saving field
- No Emery support HOT 2
- Default to Number Keyboard HOT 2
- Slider component ignoring defaultValue
- Can the colors of things be changed? HOT 5
- Can't Install Pebble Clay HOT 9
- Allow items to be in multiple groups
- Invalid attribute example for input
- unable to use Clay in emulator HOT 11
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 clay.