2012-11-01 3 views
0

Maqetta로 레이아웃을 만들었습니다. 이제 레이아웃에 로직을 추가하고 싶습니다. 따라서 Maqetta에서 전체 작업 공간을 다운로드하고 파일/라이브러리를 새로운 Rails 프로젝트로 가져 왔습니다. 처음에는 레일즈가 dojo, js 파일을로드하지 않았지만 문제를 해결했습니다.
이제 다른 문제가 있습니다. 페이지가 렌더링되지 않습니다. 하나의 위젯 (버튼)을 제외한 모든 것을 주석 처리했으며 이것이 정상적으로 작동합니다. 그러나 이것을 취소하면 아무 일도 일어나지 않습니다. 불행히도 나는 dojo에서 경고/오류 또는 그와 비슷한 것도 얻지 못합니다. 조금 노력 후
, 내가 parseOnLoad 속성을 변경하고 지금은 경고 얻을 :Dojo BorderContainer 위젯이 렌더링되지 않습니다.

여기

Unhandled Error: Tried to register widget with id==appLayout but that id is already registered

가 포함 태그입니다 : 여기

<%= javascript_include_tag "lib/dojo/dojo/dojo", :'data-dojo-config' => "'async':true, 
     'packages':[{'name':'maqetta','location':'../../maqetta'},{'name':'gridx','location':'../gridx'},{'name':'clipart','location':'../../clipart'},{'name':'shapes','location':'../../shapes'}, 
     {'name':'maqettaSamples','location':'../../../samples'},{'name':'zazl','location':'../../zazl'},{'name':'widgets','location':'../../custom'}]" %> 

은 HTML 부분입니다 (나는 그것을 단순화 , 지금은 단지) 튜토리얼에서 예를 useing 해요 : 여기

<body class="claro" data-maq-flow-layout="true" data-maq-ws="collapse" id="myapp" data-maq-appstates="{}"> 

<input type="button" data-dojo-type="dijit.form.Button" intermediateChanges="false" label="Search" iconClass="dijitNoIcon" onclick="alert('hi');"></input> 
<div 
id="appLayout" class="demoLayout" 
data-dojo-type="dijit/layout/BorderContainer" 
data-dojo-props="design: 'headline'"> 
    <div 
    class="centerPanel" 
    data-dojo-type="dijit/layout/ContentPane" 
    data-dojo-props="region: 'center'"> 
     <div> 
      <h4>Group 1 Content</h4> 
      <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> 
     </div> 
     <div> 
      <h4>Group 2 Content</h4> 
     </div> 
     <div> 
      <h4>Group 3 Content</h4> 
     </div> 
    </div> 
    <div 
    class="edgePanel" 
    data-dojo-type="dijit/layout/ContentPane" 
    data-dojo-props="region: 'top'">Header content (top)</div> 
    <div 
    id="leftCol" class="edgePanel" 
    data-dojo-type="dijit/layout/ContentPane" 
    data-dojo-props="region: 'left', splitter: true">Sidebar content (left)</div> 
</div> 

을 그리고 것은 파서 :

,
require(["dojo/parser","dojo/domReady!"], function(parser){ 
    parser.parse(); 
}); 

나는 지금 몇 시간을 노력하고 있으며, 처음에는 여전히 우둔한 상태입니다. 누군가 내가 시도 할 수있는 아이디어가 있습니까?

답변

2

Unhandled Error: Tried to register widget with id==appLayout but that id is already registered

이 오류는 사용자가 두 번 구문 분석 중이기 때문에 발생합니다. 일단로드되면 require 문에서 두 번째로로드됩니다. 두 번째 구문 분석은 동일한 ID를 가진 두 번째 위젯을 등록하려고 시도하므로 오류가 발생합니다.

구문 분석 호출 중 하나를 제거하고 테두리 컨테이너에 특정 너비와 높이를 지정하십시오. 설정된 폭 + 높이가 있어야

<div id="appLayout" class="demoLayout" 
    data-dojo-type="dijit/layout/BorderContainer" 
    data-dojo-props="design: 'headline'"  
    style="width: 800px; height: 400px"> 
+0

감사합니다. BorderContainer가 height 속성에서 백분율을 처리 할 수없는 것 같습니다. 그런 식으로 작동하지 않기 때문입니다. 왜 그런지 알아? – Shimu

+1

http://stackoverflow.com/questions/7399722/height-is-100 –

+0

감사합니다. 나는 그것을 몰랐다. – Shimu

관련 문제