Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Showing first two lines in the button label when address formatting #345

Open
WebDevTX opened this issue Mar 11, 2015 · 5 comments
Open

Comments

@WebDevTX
Copy link

How can I get the first two lines (name and address1) of the address to appear in the button label but while maintaining the address multiline format in the menu?

ui-selectmenu-item-header is obviously used for the button label, but I cant figure out how to get the first two lines in there w/o loosing the newline for the address.

I'd like it to look like this:

Button:
[ John Doe - 123 Main Street, Suite 100 ]

Menu:
| John Doe
| 123 Main Street, Suite 100
| Somewhere, US 12345
| (footer text)

But so far, I can only manage this (by matching on the first | instead of -):

Button:
[ John Doe - 123 Main Street, Suite 100 ]

Menu:
| John Doe - 123 Main Street, Suite 100
| Somewhere, US 12345
| (footer text)

Or, the normal:

Button:
[ John Doe ]

Menu:
| John Doe
| 123 Main Street, Suite 100
| Somewhere, US 12345
| (footer text)

John Doe could have multiple addresses, and only showing the name in the button doesn't provide enough feedback for what was/is selected

Thanks!

@fnagel
Copy link
Owner

fnagel commented Mar 11, 2015

Which Selectmenu widget do you want to address? The official one or the old, legacy one within this repo?

@WebDevTX
Copy link
Author

Make that the official jQ one - thanks to izaa!!

@izaa
Copy link

izaa commented Mar 12, 2015

Implement options like this

<option data-lines="John Doe # 123 Main Street, Suite 100 | Somewhere, US 12345 (footer text)" value="VAL1">John Doe - 123 Main Street, Suite 100</option>

and create your own widget like this

$.widget("custom.multilinemenu", $.ui.selectmenu, {
    _renderItem: function(ul, item) {
        var li = $("<li>", {html: addressFormatting(item.element.attr('data-lines'))});
        return li.appendTo(ul);
    }
});

$("#myselectmenu").multilinemenu() .multilinemenu( "menuWidget" ).css('height', '200px' );

@WebDevTX
Copy link
Author

You rock! Thanks! :D

@WebDevTX
Copy link
Author

NM :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants