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

DropDownList in in-line editing

1 Answer 204 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vauneen
Top achievements
Rank 1
Vauneen asked on 15 Mar 2012, 09:21 PM
Hi,
I have a grid that uses in-line editing.
i need to add a dropdownlist (with datasource) to one of the columns when it's being edited.

Has anyone done this yet?
Please help me out.
I've tried a few ways.

I thought this would work:

in my column definitions:

                columns: [
                   ...
                    { field: "AdvertType", width: "100px", editor: advertTypeEditor },       

later:
                function advertTypeEditor(container, options) {
                                $('<input name="' + options.field + '" id="Adverttypes" >').appendTo(container);
                            }

and then this:
   
           $(".Adverttypes").kendoDropDownList({
                dataTextField: "Adverttype",
                dataValueField: "ID",
                dataSource: {
                    transport: {
                        read: "data/adverttypesfordropdowns.php"
                    },
                    schema: {
                        data: "data"
                    }
                }

            });

But it's not working.

Please advise me....

Thanks,
Vauneen

1 Answer, 1 is accepted

Sort by
0
Vauneen
Top achievements
Rank 1
answered on 21 Mar 2012, 03:17 PM
i managed to figure this one out by doing this in my coloumns definition:
                   
                    { field: "SubscriptionType",  width: "150px",
                            editor: function(container, options) {                
                                $('<input name="' + options.field + '"/>').appendTo(container).kendoComboBox({
                                    dataSource: arrDataSource,
                                    dataValueField: "id",
                                    dataTextField: "title",
                                    autobind: false
                                });
                            }
                    },

and then this for the datasource:
var subsripttypes  = [ {
                  title: "Annual",
                  id: 1
               }, {
                 title: "Monthly",
                 id: 2
               }
            ];
var arrDataSource = new kendo.data.DataSource({data: subsripttypes});

Hopeful this will help someone else...

V
Tags
Grid
Asked by
Vauneen
Top achievements
Rank 1
Answers by
Vauneen
Top achievements
Rank 1
Share this question
or