Closed randaleWatson closed 5 years ago
@randaleWatson Thanks for your feedback. Right now the widget support passing the initial values but instead of initialValue it uses value property.
So, the example that we have can be something like below MultiSelect( ... ... ... value: [2,3] // instead of null )
But I take your suggestion and will make it more uniform to other standard form fields. Apart from this I have more updates to be pushed for this widget.
Thank you once again for using it and posting your feedback.
I have cloned and edited somethings on the the project and made the change to this initialValue. I will send a pull request tomorrow after I get a working test for the widget later today. Again many thanks.
How to implement prefill selected item in MultiSelect Widget and also display prefill value in widget?
I have cloned and edited somethings on the the project and made the change to this initialValue. I will send a pull request tomorrow after I get a working test for the widget later today. Again many thanks.
Can you help me for prefill value ?
I have set value: [1,3],
but it's not working, this is my code:
MultiSelect(
autovalidate: false,
titleText: "Paramédicaux",
dataSource: [
{
"display": "Dorsaf Mansouri",
"value": 1,
},
{
"display": "Imed Trabelsi",
"value": 2,
},
{
"display": "Maha Jandoubi",
"value": 3,
},
],
hintText: "Appuyez pour sélectionner un ou plusieurs",
textField: 'display',
valueField: 'value',
filterable: true,
required: true,
value: [1,3],
onSaved: (value) {
print('The value is $value');
}
)
Still get an empty view, nothing is selected !
@SlimenTN Please use initialValue: [1,3]; // for setting initial values
The full code goes like this -
MultiSelect( autovalidate: false, titleText: "Paramédicaux",
dataSource: [
{
"display": "Dorsaf Mansouri",
"value": 1,
},
{
"display": "Imed Trabelsi",
"value": 2,
},
{
"display": "Maha Jandoubi",
"value": 3,
},
],
hintText: "Appuyez pour sélectionner un ou plusieurs",
textField: 'display',
valueField: 'value',
filterable: true,
required: true,
initialValue: [1,3],
value: null,
onSaved: (value) {
print('The value is $value');
}
)
@hiddencaliber I get this error:
The argument type 'List<int>' can't be assigned to the parameter type 'int'.
initialValue is and interger not a List
MultiSelect(
{FormFieldSetter<dynamic> onSaved,
FormFieldValidator<dynamic> validator,
int initialValue,
....
@hiddencaliber sorry my bad I have to upgrade to version 0.4.0
@hiddencaliber did this package support multi language ? i want to user french instead of english.
@SlimenTN right now the text is hardcoded in some place. I am in process of giving those options to user. Stay tuned for next release
I would be nice to populate the selected values. Currently the MultiSelect.initialValue is set to int type so there cannot be a list of strings sent to be pre-selected. This can be useful when one wants to hydrate the selected options in a form when a user reopens a page that has a list of stored values.
Thank you for your work on this widget.