Search code examples
kendo-uikendo-dropdownkendo-listview

How create worked template DropDown into ListView?


Here my snipet. I have two problems. First, i can't view selected item, after i select item in dropdown and save. Second, if create new item without select domain, it has wrong site code. Domain can't be zero because site_data not contains item with code 0;

Help me please


Solution

    1. You don't see the selected item because you did not set selectable to true in the ListView.
    2. You get value 0 for domain because you did not define a default value for site in your dataSource so being a number the default value is 0 and it is not important the fact that there is no 0 in the list of values that you provide (there is no such validation). So you should have it as:

      document.provider_source = new kendo.data.DataSource({
        pageSize: 6,
        schema: {
          model: {
            id: "code",
            fields: {
              code: { editable: false, nullable: true },
              site: { type: "number", defaultValue: 1 },
              login: { type: "string" },
              pass: { type: "string" }
            }
          }
        },
        data: provider_data
      });
      

    Where I set defaultValue for site to 1 (first value in the list).

    Your code modified here: http://dojo.telerik.com/@OnaBai/Ihab