-
Notifications
You must be signed in to change notification settings - Fork 55
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
displayValueConfig not working after Ajax change of Value #24
Comments
Yes its supposed to automatically generate the displayed value based on In addition, for complex use cases you can also send it with the Json output from your controller which will be displayed. The json response is // if output is empty (which is the default) the extension will use the input element value to display
$out = Json::encode(['output'=>'', 'message'=>'']);
// if output is set to a value then extension will display this instead of the input element value
$out = Json::encode(['output'=>'forbidden', 'message'=>'']); |
I will go with second option. Thanks! |
I forgot that I use the same Action for all model attributes. So the second one is not going to work. |
The problem is "Json::encode()" in 'InputWidget'. The 'Json::encode()' creates the array 'displayValueConfig', eliminating the 'key' if they are numeric. To work, it would be good to put the number 80 in 'Json::encode()'. $this->_encOptions = empty($this->pluginOptions) ? '' : Json::encode($this->pluginOptions, 80); Before you make the change javascript looks like this: var editable_950d7e48 = {"defaultValue":"<em>(not set)</em>","placement":"left","target":".kv-editable-link","displayValueConfig":["Forbidden","Allowed"],"showAjaxErrors":true}; After the change var editable_950d7e48 = {"defaultValue":"<em>(not set)</em>","placement":"left","target":".kv-editable-link","displayValueConfig":{"0":"Forbidden","1":"Allowed"},"showAjaxErrors":true}; |
You do not require to change Json encode for this. I have provided a fix. |
@kartik-v tranks! |
That is relevant part of widget and It works fine. But after ajax change it shows 0/1 instead of allowed/forbidden. Is that normal? IMHO it should apply formula to that thing. Or at least expose the display container in pluginEven something like below so that one can simly do what he wants
The text was updated successfully, but these errors were encountered: