• About Morris Development
  • A Focus for Cloud Efficiency
    • Microsoft Azure
    • Amazon Web Services
  • What our Clients Say
  • Our Products
    • PreschoolDB
    • WebinarDB
  • Contact Us

Morris Development

Custom System Development and Integration

June 4, 2015

Kendo Dropdowns

Kendo Dropdowns are fairly easy to use. They take a while to get comfortable with, but here are some basics to help you on your way.

Here is a simple dropdown I use to list warehouses. There are a couple key points that are vital to making this work for you. Primarily, make sure that you have a complete and error setting for your transport. Seriously, this can save you a lot of headaches.

        $("#drpWarehouse").kendoDropDownList({
            dataTextField: "warehouse",
            dataValueField: "warehouse_id",
            dataSource: {
                transport: {
                    read: {
                        url: "warehouses-data.ashx?sid=" + session_id,
                        dataType: "json", // specifies data protocol
                        complete: function (jqXHR, textStatus) { console.log(textStatus, "read warehouse records"); 
                            if (WarehouseId > 0) {
                                console.log('setting warehouse dropdown');
                                setDropDown($("#drpWarehouse"),WarehouseId)
                        } }
                    },
                    error: function (er) { console.log(e) },
                } 
            }
               ,
            change: function (e) {
                console.log('updated warehouse ' + this.value());                
            }

        });

Another vital point is how to set those values. If you are accustomed to .Net WebForms, you’ll really be hating the lack of a ViewState. So, when you open a record, you’ll need to load the data and THEN you’ll set the dropdown to the appropriate value. I use a simple function:

 function setDropDown(obj,id){
             
            var w = obj.data("kendoDropDownList");
          
            w.select(function(dataItem) {
                return dataItem.warehouse_id === id.toString();
            });
            
        }

You can see how I called it by looking at the “complete” event of the transport. Unfortunately, I have not yet gotten around to making it completely generic, as you can see by the “return dataItem.warehouse_id ===”. You’ll need to set that to the appropriate value for whatever you’re doing. (or I’ll update this later on).

Gotchas: A BIG annoyance I had here was the fact that the dataItem values are STRING. My id was an integer. It probably took me 30 minutes to realize that it was perfect except I had to add .toString() to the end of my id.

Article by MacGyver / Kendo, Web Developer

About MacGyver

I've worked with database systems for over 20 years, and started my own company in 2000. Almost all my business consists of internal database systems, either ERP or CRM. My programming is primarily in Angular / Microsoft C# and MS SQL.

About This Site

Morris Development has been specializing in internal database system design and integration since 1999. We provide long-term management and support of secure data systems for many businesses as well as developing the more complex code structures for ERP systems like Intellievent, Apidas, and AVMS.

This site is primarily for our developers to keep track up various technologies and updates that are used by Morris Development.

Training

Integrating Angular Microsite with .Net

Private Data Caching with Google Storage

Continuous Deployment for Production Releases?

Azure Websites – the perfect Angular host

Angular 2

  • Angular 2 Authentication
  • Angular Command Line Interface
  • Material Design for Angular
  • Using Observables in Angular 2

Mentors

  • Ben Nadel
  • Dan Wahlin
  • Deborah Kurata
  • John Papa

Staff

  • Dan Morris

Training

  • Google Development Courses
  • Microsoft Virtual Academy
  • PluralSight
  • Test Deep Links

© 2025 · Morris Development