2012-10-19 45 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