2016-07-28 23 views
0

forループの使用方法joint.shapes.umlです。私はそれを使うことができないのか、それを使うことはできないのか分からないループfor for JointJs

var uml = joint.shapes.uml; 
    var classes = { 
      @Model.Entity[0]: new uml.Class({ 
       position: { x: 30, y: 40 }, 
       size: { width: 200, height: 220 }, 

       name: '@Model.Entity[0]', 
       attributes: ['@Model.Column'], 
       methods: [], 
       attrs: { 
        '.uml-class-name-rect': { 
         fill: 'white', 
         stroke: 'black', 
         'stroke-width': 2, 
        }, 
        '.uml-class-attrs-rect, .uml-class-methods-rect': { 
         fill: 'white', 
         stroke: 'black', 
         'stroke-width': 2, 
        }, 
       } 
      }), 

      @Model.Entity[1]: new uml.Class({ 
       position: { x: 624, y: 103 }, 
       size: { width: 200, height: 150 }, 
       name: '@Model.Entity[1]', 
       attributes: ['DeptName', '...', 'Etc.'], 
       methods: [], 
       attrs: { 
        '.uml-class-name-rect': { 
         fill: 'white', 
         stroke: 'black', 
         'stroke-width': 2, 
        }, 
        '.uml-class-attrs-rect, .uml-class-methods-rect': { 
         fill: 'white', 
         stroke: 'black', 
         'stroke-width': 2, 
        }, 
       }, 
      }) 
     }; 

     graph.addCells(classes); 

ありがとうございます。

答えて

0

すでにループが終了しています。

var prepareDesign = function(designItems, connectors){ 
     $.each(designItems, function(index, value) { 
      addDesignItem(value); 
     }); 
     $.each(connectors, function(index, value) { 
      addConnector(value); 
     }); 
    } 
    var connectors = @Html.Raw(Json.Encode(Model.Relationship)); 
    var designItems = @Html.Raw(Json.Encode(Model.Entity)); 
    prepareDesign(designItems, connectors);