2012-10-19 3 views
1

"새 레코드 추가"JTable 및 Jtable 항목 목록에서 listbox를 만들고 싶습니다.고급 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; } 

     } 
    } 

중요한 것은 (이 클래스가 목록의 ID와 이름) :

:보기에서

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

내가 예를 보여

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

클래스

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