2012-10-19 46 views
1

我想在Jtable中的選項「添加新記錄」JTable和項目列表中創建列表框。高級JTable數據列表

我的模型:

namespace CRM.ViewModels.Administrator.Dictionary.OfferNewInformation 
    { 
     public class DictionaryNewInfoListModel : DictionaryListModel 
     { 
      public string Description { get; set; } 
      public bool IsActiveYN { get; set; } 
      public bool CPGroupType { get; set; } 
      public bool TCPGroupType { get; set; } 
      public bool CCGroupType { get; set; } 
      public bool HOGroupType { get; set; } 
      public bool TSGroupType { get; set; } 
      public int CityId { get; set; } 
      public List<DictionaryNewInfoSupportList> DeestynationName { get; set; } 

      // public IList<SelectListItem> DestinationList { get; set; } 

     } 
    } 

重要的東西(這個類有列表編號和名稱):

public List<DictionaryNewInfoSupportList> DeestynationName { get; set; } 

public class DictionaryNewInfoSupportList 
{ 
    public int Id; 
    public string Name; 
} 

在查看我秀例如:

fields: { 
        Id: 
        { 
         key: true, 
         create: false, 
         edit: false, 
         list: false 
        }, 
        Description: { 
         title: 'Treść' 

        }/*, 
        DeestynationName: { 
         title: 'Treść' 

        }*/, 
        CPGroupType: { 
         title: "CP", 
         edit: true, 
         type: 'checkbox', 
         values: { 'false': 'Nie', 'true': 'Tak' } 
        }, 
        TCPGroupType: { 
         title: "TCP", 
         edit: true, 
         type: 'checkbox', 
         values: { 'false': 'Nie', 'true': 'Tak' } 
        }, 
        CCGroupType: { 
         title: "CC", 
         edit: true, 
         type: 'checkbox', 
         values: { 'false': 'Nie', 'true': 'Tak' } 
        }, 
        HOGroupType: { 
         title: "Centrala", 
         edit: true, 
         type: 'checkbox', 
         values: { 'false': 'Nie', 'true': 'Tak' } 
        }, 
        TSGroupType: { 
         title: "Kasjer", 
         edit: true, 
         type: 'checkbox', 
         values: { 'false': 'Nie', 'true': 'Tak' } 
        } 

但正如你所看到的,我不知道如何聲明DeestynationName。項目

列表(例如 - 我需要什麼)

if(DeestynationName.id==model.id) show list of Name 

在「添加新記錄」我需要列表框與在此列表中的元素(例如 - 我需要什麼):

@Html.DropDownListFor(m => m.CurrentVoucher, new System.Web.Mvc.SelectList(Model.DictionaryNewInfoSupportList, "Id", "Name"), new { style = "width:140px" }) 

回答

0

我開始思考這個問題,這是非常困難的。我嘗試添加「部分視圖」,但我得到的錯誤:無法加載CityId列表

這個錯誤我得到 - 在選項時,我把這個部分視圖。如果我只刪除這一行,項目編譯正確。當然,如果我刪除這個選項,我有空的地方在列表中,但數據工作正確的列表。當然,我需要這個部分視圖。

  CityId: { 
       title: 'City', 
       width: '11%', 
       options: '@Url.Action("GetCityOptions")' 
      }, 

,我加入控制器:

namespace dd 
{ 
    [Themed] 
    public class AdministratorController : DefaultController 
    { 
     [CustomAuthorize] 
     public ActionResult Index() 
     { 
      return View(); 
     } 

     public ActionResult GetCityOptions() 
     { 
      return View(); 
     } 
    } 
} 

和局部視圖來理解這個問題。

@model CRM.ViewModels.Administrator.DictionaryModel 

@{ 
    ViewBag.Title = "GetCityOptions"; 
} 

<h2>GetCityOptions</h2> 
dfsfdsfds