Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 剑道UI层次结构子架构_Javascript_Jquery_Kendo Ui_Telerik_Kendo Treeview - Fatal编程技术网

Javascript 剑道UI层次结构子架构

Javascript 剑道UI层次结构子架构,javascript,jquery,kendo-ui,telerik,kendo-treeview,Javascript,Jquery,Kendo Ui,Telerik,Kendo Treeview,关于Kendo的API引用(证明:),可以在下一种方法中声明子节点(请参见嵌套的“schema”作为“为第二级定义选项”): 我对HierarchycalDataSource使用类似的定义,并以这种方式获取子节点: schema: { model: { id: "urb_fltr", hasChildren: true, children: "PhoneCalls" // <- here is definition for children that are -

关于Kendo的API引用(证明:),可以在下一种方法中声明子节点(请参见嵌套的“schema”作为“为第二级定义选项”):

我对HierarchycalDataSource使用类似的定义,并以这种方式获取子节点:

schema: {
  model: {
    id: "urb_fltr",
    hasChildren: true,
    children: "PhoneCalls" // <- here is definition for children that are - data from field of output (next in parse)
  },
  parse: function (data) {
    var outRes = [];
    var dataRes = [];
    var tmpLoop = 0;
    var bordNum = 251170009;

    if (data.d.results != null && data.d.results.length > 0)
      for (var step = 0; step < data.d.results.length; step++) {

        if (data.d.results[step] == null) continue;

        var stepData = data.d.results[step];

        var stepValue = (stepData.urb_subject != null) ? stepData.urb_subject.Value : 0;

        var arrValue = (stepValue > bordNum) ? stepValue - bordNum : 0;

        if (outRes[arrValue] == null || typeof (outRes[arrValue]) == 'undefined') {
          outRes[arrValue] = {};
          outRes[arrValue].urb_total = 1;
          outRes[arrValue].urb_clnts = 0;

          outRes[arrValue].OwnerId = stepData.OwnerId;
          outRes[arrValue].urb_subjectValue = stepValue;

          outRes[arrValue].PhoneCalls = []; // <- children
        }
        else
          outRes[arrValue].urb_total += 1;
        // fill children field
        outRes[arrValue].PhoneCalls[outRes[arrValue].urb_total - 1] = {};
        outRes[arrValue].PhoneCalls[outRes[arrValue].urb_total - 1].CallId = stepData.ActivityId;
        outRes[arrValue].PhoneCalls[outRes[arrValue].urb_total - 1].urb_name = stepData.urb_name;
        outRes[arrValue].PhoneCalls[outRes[arrValue].urb_total - 1].CreatedOn = stepData.CreatedOn;
        outRes[arrValue].PhoneCalls[outRes[arrValue].urb_total - 1].PhoneNumber = stepData.PhoneNumber;
        outRes[arrValue].PhoneCalls[outRes[arrValue].urb_total - 1].ScheduledEnd = stepData.ScheduledEnd;

        if (stepData.RegardingObjectId != null && stepData.RegardingObjectId.Id != null && stepData.RegardingObjectId.LogicalName == "lead") {
           outRes[arrValue].PhoneCalls[outRes[arrValue].urb_total - 1].RegardingObjectId = stepData.RegardingObjectId;
        outRes[arrValue].urb_clnts += 1;
        }
      }

      for (var loop = 0; loop < outRes.length; loop++)
         if (typeof (outRes[loop]) != 'undefined') {
             outRes[loop].urb_subjectName = outRes[loop].urb_subjectName + " ( " + outRes[loop].urb_total + " - " + outRes[loop].urb_clnts + " )";
             dataRes[tmpLoop] = outRes[loop];
             tmpLoop++;
         }

       return dataRes; //data.d.results;
    },
    type: "json"
}
模式:{
型号:{
id:“urb_fltr”,
有孩子:是的,
子项:“电话呼叫”//0)
对于(var步长=0;步长bordNum)?stepValue-bordNum:0;
if(outRes[arrValue]==null | | typeof(outRes[arrValue])==undefined'){
outRes[arrValue]={};
outRes[arrValue].urb_总计=1;
outRes[arrValue].urb\u clnts=0;
outRes[arrValue].OwnerId=stepData.OwnerId;
outRes[arrValue].urb_subjectValue=stepValue;

outRes[arrValue].PhoneCalls=[];//您只需设置treeview的数据,无需定义架构即可完成

数据=[{id:'1',文本:'Music',条目:[{id:'1.1',文本:'Country',条目:[]},{id:'1.2',文本:'Jazz',条目:[]}]

$(“#treeView”).data(“kendoTreeView”).dataSource.data(data);

解决方案: 1.忘记“children”中的“schema”大括号-返回“PhoneCalls”字符串值。 2.在“PhoneCall”对象(来自“PhoneCalls”集合)中添加“hasChildren”属性,并在“false”中设置值

如果要添加新级别的treeview: 1.将“PhoneCall”对象的“hasChildren”属性设置为“true” 2.将下级集合添加为“PhoneCall”对象的属性
3.在“PhoneCall”对象中添加“children”属性,该属性将是第2页中set属性的字符串值-名称。没错!该集合可以包括kendo ui在“schema”定义中使用的“hasChildren”或“children”等属性。
schema: {
  model: {
    id: "urb_fltr",
    hasChildren: true,
    children: "PhoneCalls" // <- here is definition for children that are - data from field of output (next in parse)
  },
  parse: function (data) {
    var outRes = [];
    var dataRes = [];
    var tmpLoop = 0;
    var bordNum = 251170009;

    if (data.d.results != null && data.d.results.length > 0)
      for (var step = 0; step < data.d.results.length; step++) {

        if (data.d.results[step] == null) continue;

        var stepData = data.d.results[step];

        var stepValue = (stepData.urb_subject != null) ? stepData.urb_subject.Value : 0;

        var arrValue = (stepValue > bordNum) ? stepValue - bordNum : 0;

        if (outRes[arrValue] == null || typeof (outRes[arrValue]) == 'undefined') {
          outRes[arrValue] = {};
          outRes[arrValue].urb_total = 1;
          outRes[arrValue].urb_clnts = 0;

          outRes[arrValue].OwnerId = stepData.OwnerId;
          outRes[arrValue].urb_subjectValue = stepValue;

          outRes[arrValue].PhoneCalls = []; // <- children
        }
        else
          outRes[arrValue].urb_total += 1;
        // fill children field
        outRes[arrValue].PhoneCalls[outRes[arrValue].urb_total - 1] = {};
        outRes[arrValue].PhoneCalls[outRes[arrValue].urb_total - 1].CallId = stepData.ActivityId;
        outRes[arrValue].PhoneCalls[outRes[arrValue].urb_total - 1].urb_name = stepData.urb_name;
        outRes[arrValue].PhoneCalls[outRes[arrValue].urb_total - 1].CreatedOn = stepData.CreatedOn;
        outRes[arrValue].PhoneCalls[outRes[arrValue].urb_total - 1].PhoneNumber = stepData.PhoneNumber;
        outRes[arrValue].PhoneCalls[outRes[arrValue].urb_total - 1].ScheduledEnd = stepData.ScheduledEnd;

        if (stepData.RegardingObjectId != null && stepData.RegardingObjectId.Id != null && stepData.RegardingObjectId.LogicalName == "lead") {
           outRes[arrValue].PhoneCalls[outRes[arrValue].urb_total - 1].RegardingObjectId = stepData.RegardingObjectId;
        outRes[arrValue].urb_clnts += 1;
        }
      }

      for (var loop = 0; loop < outRes.length; loop++)
         if (typeof (outRes[loop]) != 'undefined') {
             outRes[loop].urb_subjectName = outRes[loop].urb_subjectName + " ( " + outRes[loop].urb_total + " - " + outRes[loop].urb_clnts + " )";
             dataRes[tmpLoop] = outRes[loop];
             tmpLoop++;
         }

       return dataRes; //data.d.results;
    },
    type: "json"
}
children: { // <- instead of "PhoneCalls" - next 'schema'
  schema: {
    data: "PhoneCalls",
    model: { hasChildren: false }
  }
}