This is a migrated thread and some comments may be shown as answers.

How do we combine 2 values to show as comboxo datatextfield

2 Answers 1784 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Emily
Top achievements
Rank 1
Emily asked on 24 Feb 2014, 02:30 PM
We have data bound to a combox, all is working fine. When the user clicks the dropdown the list of items appears and is showing data assigned by the template  -> template: "#=FirstName # #=LastName #,  #=CompanyName #",
        
However, once the user selects something the datatextfield is shown, where as we want the same template shown. How can we do this?

Thanks - here is our code.


 $(this).kendoComboBox({
                placeholder: "Select A Client...",
                //dataTextField: 'LastName',
                dataValueField: 'ContactID',
                template: "#=FirstName # #=LastName #,  #=CompanyName #",
                filter: "contains",
                autoBind: false,
                minLength: 3,
                text: $(this).attr('data-text'),
                dataSource: {
                    type: "odata",
                    serverFiltering: true,
                    serverPaging: true,
                    page: 1,
                      pageSize: 50,                    
                    sort: { field: "Name", dir: "asc" },
                    filter: filter,
                    transport: {
                        read: {
                            url: "/ajax/comboContactFilter.json",
                        }
                    }
                }
            });

2 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 25 Feb 2014, 12:42 PM
Hello Emily,

There are two options to accomplish this task. The first one is to create a third property on the server and directly use it on the client. It will be the fastest way to achieve this. The second approach is to use parse method of the data source and create calculated field on the client side. Here is a jsBin demo showing how the second approach is implemented.

Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Eric
Top achievements
Rank 1
answered on 27 Mar 2014, 07:41 PM
Hello,

This is my code for server side traitment :

while($obj = mysql_fetch_object($rs)) {
    $arr[] = $obj;
}

foreach($arr as $row) {
    $row->completename = $row->firstname." ".$row->lastname;
}
Tags
General Discussions
Asked by
Emily
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Eric
Top achievements
Rank 1
Share this question
or