How to Concatenate Two Values into FormComboBox textField

1 Answer 202 Views
ComboBox DropDownList
Daniel
Top achievements
Rank 1
Daniel asked on 05 Sep 2023, 03:50 PM | edited on 05 Sep 2023, 03:57 PM

I'm trying to concatenate two values into the textField property for FormComboBox, but it doesn't allow me. Instead I get an error:

Uncaught runtime errors:
ERROR
_utils__WEBPACK_IMPORTED_MODULE_2__.getItemValue(...) is undefined

My code is below. Perhaps someone can help?

<Field
	key={'personU'}
	id={'personU'}
	name={'personU'}
	label={'U'}
	textField={'abc' + 'def'}
	dataItemKey={'uic'}
	placeholder={'U...'}
	component={FormComboBox}
	allowCustom={true}
	data={units}
	virtual={{
		total: uCount,
		pageSize: uPageSize,
		skip: page
	}}
	onPageChange={pageChange}
	/>

 I've tried the following:

textField={'abc' + 'def'}
textField={`${abc} ${def}`}

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 06 Sep 2023, 07:05 AM

Hi Daniel,

The textField property of the ComboBox expects a single string value that will point to a property in the underlying dataItem that will be displayed. For displaying multiple values from the data item you will have to use the itemRender and the valueRender of the ComboBox as shown in the following example:

Another option is to add new field in the data bound to the ComboBox that will represent the text that you want to display and set the "textField" to that new field.

Hope this helps.

 

Regards,
Konstantin Dikov
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources!

Daniel
Top achievements
Rank 1
commented on 12 Sep 2023, 06:44 PM | edited

Thank you!
Tags
ComboBox DropDownList
Asked by
Daniel
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or