[CLOSED] Cascading combo box Fuctionality.

  1. #1

    [CLOSED] Cascading combo box Fuctionality.

    Hi,

    In below code I have Model in which there are two list DataCategory List and another is DataType list. On selection of Data category I want to have Data Type.With the example shown in the link http://mvc.ext.net/#/Form_ComboBox/Ajax_Linked_Combos/
    there is a call which pull the data and fill the combo but in my case I already have the data into the DataType list.

    So I just need to write the condition on the list.I tried to write the condition inside DataSource property of the DataType combo.
    but here App.DataCategory.getValue() is not working as App is not recognized here. Can you help in getting the value of DataCategory Combo in this condition.


    Html.X().ComboBoxFor(ad=>ad.DataCategoryId)
                .ID("DataCategory")  
                .Padding(5)
                .Editable(false)
                 .DisplayField("Data_Category_Desc")
                 .ValueField("Data_Category_Id")
                .QueryMode(DataLoadMode.Local)
                .TriggerAction(TriggerAction.All)
                .SelectOnFocus(true)
                .EmptyText("Select Category")
               .Listeners(ls =>
                ls.Select.Handler = "App.DataType.clearValue(); App.DataType.getStore().load())")
                .Items((from dataCategory in Model.DataCategoryList select new Ext.Net.ListItem 
                                             { Text = dataCategory.Data_Category_Desc, Value = dataCategory.Data_Category_Id.ToString() })      
                )
    
      Html.X().ComboBoxFor(um => um.DataTypeId)
                    .ID("DataType")
                    .DisplayField("Data_Type_Desc")
                    .ValueField("Data_Type_Id")
                    .EmptyText("Loading...")
                    .ValueNotFoundText("Loading...")
                    .Store(Html.X().Store()
                                    .ID("CmbStore")
                                    .AutoLoad(false)
                                     .Model(Html.X().Model()
                                            .IDProperty("Data_Type_Id")   
                                            .Fields(
                                                                new ModelField("Data_Type_Id", ModelFieldType.String) { Mapping = "Data_Type_Id" },
                                                                new ModelField("Data_Type_Desc", ModelFieldType.String) { Mapping = "Data_Type_Desc" }
                                                    )
                                            )
                                        .DataSource(Model.DataTypeList.Where(um => um.Data_Category_Id == 1))
                                )
    MODEL:- AddNewDataFileDTO

     public class AddNewDataFileDTO
        {
            public int DataCategoryId { get; set; }
            public string DataCategory { get; set; }
            public int DataTypeId { get; set; }
            public string DataType { get; set; }
    
            public List<DataCategoryDTO> DataCategoryList { get; set; }
            public List<DataTypeDTO> DataTypeList { get; set; }
        }
    Last edited by Daniil; Mar 07, 2013 at 9:53 AM. Reason: [CLOSED]
  2. #2
    Hi @alscg,

    Do you want to bind data this way initially or on user choice (I mean selecting an item by a user)?

    If the first, I think you should get a key directly from a Model.

    If the second, I think it is not possible, because the view is already rendered. You will have to reload a Store as it is done in the example you mentioned.

Similar Threads

  1. [CLOSED] Where is the example located for cascading dropdown??
    By Fahd in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 10, 2012, 1:03 PM
  2. [CLOSED] [MVC] Cascading multi Partial views
    By UnifyEducation in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: May 10, 2012, 2:10 PM
  3. [CLOSED] Cascading TimeFields with at least 30 Minutes between
    By macap in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 15, 2010, 7:34 AM
  4. Replies: 3
    Last Post: Jul 01, 2009, 5:27 AM
  5. [CLOSED] Can't get three cascading comboboxes to work
    By harafeh in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 13, 2009, 1:58 PM

Posting Permissions