本文介绍了如何在dhtmlx甘特图中绑定动态数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何动态数据绑定在dhtmlx甘特图中





动态数据用于循环



我尝试过:



how to dynamic data bind in dhtmlx gantt chart


with dynamic data use for loop

What I have tried:

//for (var i = 0; i < 5; i++)
                   //{
                   //    data.push({
                   //        "data" :  { "id": 1, "text": "Strand Pickling", "Job": "3.1.9", "ONumber": "1", "Itm": "0.89 MM NT BW", "Qty": "50", "start_date": "28-03-2017", "end_date": "01-04-2017 21:00:00", "ItemName": "2", "duration": "3", "progress": 0.2, "open": true },
                   //    })
                   //}

推荐答案

foreach (DataRow dr in dt.Rows)
           {
               if (buffer == string.Empty || buffer != dr["SectionName"].ToString())
               {
                   parent = 0;
                   ProSchedular.Add(new Production(i + 4, dr["SectionName"].ToString(),emptydata,emptydata,emptydata,emptydata, dr["sdate"].ToString(),
                                                       dr["edate"].ToString(), parent));
                   parent = i + 4;

                   ProSchedular.Add(new Production(i + 5, dr["machines"].ToString(), dr["JobNo"].ToString(), dr["OrderNumber"].ToString(), dr["ItemName"].ToString(),
                                  dr["ProductionQuantity"].ToString(), dr["sdate"].ToString(), dr["edate"].ToString(),parent));

                   buffer = dr["SectionName"].ToString();
               }
               else
                   ProSchedular.Add(new Production(i + 6, dr["machines"].ToString(), dr["JobNo"].ToString(), dr["OrderNumber"].ToString(), dr["ItemName"].ToString(),
                                 dr["ProductionQuantity"].ToString(), dr["sdate"].ToString(), dr["edate"].ToString(), parent));

               i = i + 7;
           }


           return ProSchedular;
       }
       catch (Exception ex)
       {
           logwriter.Debug(ex.Message.ToString());
           //objMas.PrintLog(" Pageid : " + pageid + " First Time page load  Fetch Details From CardMaster : ",ex.Message.ToString());
           return ProSchedular;
       }

   }
     public class Production//pagedetail
     {
         public int id = 0;
         public string start_date = "", end_date = "", text = "", Job = "", ONumber = "", Itm = "", Qty = "";
         public int parent;
         public bool open;
         public string buffer = "";

         public Production(int  i,string section,string jobNumber,string OrdNum,string Item ,string qty,string SDate, string EDate,int p)
         {
             if (buffer == string.Empty || buffer != section)
             {
                 id = i; text = section; Job = jobNumber; ONumber = OrdNum; Itm = Item; Qty = qty; start_date = SDate; end_date = EDate;open = true;
                 parent = p;buffer = section;
             }
             else
             {
                 id = i; text = section; Job = jobNumber; ONumber = OrdNum; Itm = Item; Qty = qty; start_date = SDate; end_date = EDate; open = true;
                 parent = p;
             }
         }
     }


这篇关于如何在dhtmlx甘特图中绑定动态数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 22:00