-
Notifications
You must be signed in to change notification settings - Fork 820
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
API: Treedropdownfield showsearch default true, provide better ui #2364
Conversation
Hey Naomi, that's a really cool solution for this, so simple and effective :) Some notes:
|
Also, in terms of merging this into 3.1: Its kind of an API change, but not a very disruptive one. It simply makes an existing field easier to use. We should nevertheless mention it, since some TreeDropdownFields might deal with hierarchical data that needs a specialized |
Set search option true on treedropdown fields by default, to provide a fallback solution when trees fail to render (too many children errors) Provide better indication/more meaningful styling to search (match chosen styles for consistency)
Added changelog file. First time I've ever done that though, so not sure if I did it right. |
API: Treedropdownfield showsearch default true, provide better ui
Yeehaw, we're finally getting close to an actually useable tree UI control. Thanks so much for taking that on Naomi. The upgrading guide is fine. Maybe a bit verbose (we try to keep it easy to scan and comprehend), but we can tidy that up before the release. |
@chillu @adrexia Hate to ring the bell when things aren't working, but currently when trying to select a parent page in Add Page. It stays with (Choose), I have checked if it only happens with custom page types but this isn't the case. It does select the page type when adding a page with parent selected, so the URL Parameters work. Using latest branch of 3.1 on Mac OS X with Chrome. |
@adrexia You changed the semantics of Also, the change to default $showSearch=true did have some unintended side effects. It reveals that the search isn't actually operational for SiteTree and File records since the $labelField defaults to "TreeTitle". That's a composite field from PHP, not an acutal DB field, which fails the search SQL. We've used |
I've removed placeholder fallbacks, which makes getValue() operational again: 93ea066. Reasoning in commit message. We could look into a generic placeholder polyfill. The most common one is https://github.com/mathiasbynens/jquery-placeholder, but it was year old unmerged pull requests and 50+ issues on 175 lines of code... |
It breaks the semantics of getValue(), leading to a broken field. Regression from 8b5f89f. In the end, placeholder support is considered "progressive enhancement", the search box should be pretty obvious to IE8/IE9 users either way, given the main field label is called "choose or search".
This is a workaround in order to ensure the field stays operational for SiteTree and File records with the new $showSearch=true default. Previously it was necessary to use setSearchCallback(), otherwise the SQL query would fail. One limitation to keep this change generic is that "MenuTitle" won't be used to search, since its SiteTree specific, while the "Title" and "Name" fields are generally regarded as model conventions (e.g. they're used in DataObject->getTitle() as well). See silverstripe#2364
Tested in Chrome, Firefox, IE8 and IE9