X-Editable - How to do "Custom input, several fields"
Asked Answered
A

2

15

I am playing around with x-editable and I am wondering how they do the last example in their demo page.

http://vitalets.github.io/x-editable/demo-bs3.html?c=inline (Custom input, several fields)

I can't find any thing that actually shows you the code for each part. I only can dig through it with firebug but that is more time consuming and I rather just see the parts I need.

Any have the pieces of code that does it?

Algy answered 14/4, 2014 at 23:11 Comment(0)
K
12

Yes, @marcb is right!

So here: https://github.com/vitalets/x-editable

Or to be exact: https://github.com/vitalets/x-editable/blob/master/src/inputs-ext/address/address.js

Kingsley answered 3/12, 2014 at 16:13 Comment(2)
For the lazy: <a href="#" id="address" data-type="address" data-pk="1">value here</a> $('#address').editable({ url: '/post', title: 'Enter city, street and building #', value: { city: "Moscow", street: "Lenina", building: "15" } });Laellaertes
This is disappointing. The support isn't there for an arbitrary set of custom fields as the label in the example suggests. Actually it's support for a 3 field object corresponding to the data-type="address" field type, similar to how the "combodate" field type results in multiple inputs. Yes, you could write your own extension similar to what's in address.js to handle a different or an arbitrary set of fields in the value: object, but that's not really an out of the box solution. :(Connatural
B
10

The code for this can be found in the X-editable Bootstrap 3 download, under "inputs-ext", and then the "address" folder.

Bra answered 16/4, 2014 at 10:12 Comment(2)
I don't 100% get it, do I have to make my own "address.js" class with all those methods?Algy
essentially, yes. I personally haven't created a new class as I haven't needed to (yet), however it seems pretty well documented.Bra

© 2022 - 2024 — McMap. All rights reserved.