1

こんにちは、mvc razor で dhtmlx スケジューラを使用しています。

単位タブを作成しました。しかし、イベントを異なるユニットに分割する方法がわかりません。これが私のサンプルコードです。

Scheduler.InitialDate = DateTime.Now.Date;// the initial data of Scheduler   
var unit = new UnitsView("Employee", "EmpID");//initializes the view
var rooms = new List<object>(){
    new { key = "1", label = "Employee1"},
    new { key = "2", label = "Employee2"},
    new { key = "3", label = "Employee3"},
    new { key = "4", label = "Employee4"}
};
unit.AddOptions(rooms);
Scheduler.Views.Add(unit);

ストアド プロシージャを使用して ID と表示名を取得しましたが、 と の設定に問題がkey=IDありlabel= displaynameます。

スケジューラのユニットビューに名前を表示するのを手伝ってください。mvc3 razor で最初にエンティティ データベースを使用します

これは私がすでに試したコードですが、途中で打たれました。

var unit = new UnitsView("units", "resourcename");
scheduler.Views.Add(unit);
List<GetResourceOrderDisplay_Result> resourcedisplayname = 
           new List<GetResourceOrderDisplay_Result>();
resourcedisplayname = _scheduler.Getresorderdisplay();
DashboardViewModel objDashboardViewModel = new DashboardViewModel();
var options = new List<object>();
//how to add key and label from the result i'm getting from resourcedisplayname?

unit.AddOptions(options);

>

public partial class GetResourceOrderDisplay_Result
{
    public int ID { get; set; }
    public string DisplayName { get; set; }
}

モデル:

public class DashboardViewModel
{
    //scheduler unitsview
    public int ID { get; set; }
    public string DisplayName { get; set; }
}

これは、ストアドプロシージャからIDと表示名を取得する場所です

public List<GetResourceOrderDisplay_Result> Getresorderdisplay()
{
    List<GetResourceOrderDisplay_Result> oGetresorderdisplay = 
                  new List<GetResourceOrderDisplay_Result>();

    oGetresorderdisplay = dbContext.GetResourceOrderDisplay().ToList();

    return oGetresorderdisplay.ToList();
}

PKKG さん、お時間をありがとうございました :) これで解決しました。ここに解決策があります。改善のために以下にコメントを残してください:)

     var unit = new UnitsView("units", "ID");
...............
......

         var options = new List<object>();
                      foreach (var name in resourcedisplayname)
                      {


   options.Add(new { key = name.ID, label = name.DisplayName });
                  }
                unit.AddOptions(options);
4

0 に答える 0