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

Add hooks to update returned item data #4

Open
micmania1 opened this issue Mar 20, 2014 · 2 comments
Open

Add hooks to update returned item data #4

micmania1 opened this issue Mar 20, 2014 · 2 comments
Assignees

Comments

@micmania1
Copy link

At the moment you can only return a single database field which prevents you from knowing immediately which ID or DataObject this field belongs to.

Adding the hook would allow more complex structures to be returned. This would leave the dev with the job of blocking the AutoComplete.js and creating their own, but would add more flexibility.

See here regarding returned data: http://jqueryui.com/autocomplete/#custom-data

@micmania1
Copy link
Author

ps. By 'hook' I mean a callback function to be instance-specific - not a DataExtension which would apply globally.

Example:

$this->setItemFormatCallback(function() { //... blah });

@tractorcow tractorcow self-assigned this Mar 20, 2014
@tractorcow
Copy link
Owner

So you would add a hook around https://github.com/tractorcow/silverstripe-autocomplete/blob/3.1/code/AutoCompleteField.php#L255 to customise the ability to extract a value from the dataobject? This can be done pretty easily. :)

I don't see why we couldn't extend it though, since you could add an extension that allows you to assign a callback if needed.

I haven't touched this module for a while and I can see soo many bugs just by looking at the code. =( I'll mark this module to be freshened up.

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

No branches or pull requests

2 participants