Bonjour ,

J 'utilise le toolkit dojo workers : http://demos.dojotoolkit.org/demos/skew/demo.html, pour présenter des information sur des personnes et je veux présenté certain information dans une datagrid.

Le souci c'est que je ne sais pas comment personnaliser la datagrid pour quelle me présente les information lié à une personne. je pense que je peux résoudre ce souci on utilisant javascrip et comme je suis une débutante j'ai du mal à voir comment faire.

les données de la personne sont en format json exemple :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
var data ={"items": [ {"imgUrl" :"images/users/toto.jpg","name" :" ","location" :" ","website" :"www.....","donneesdatagrid": {"items": [ {"mutation" :" ", "taches" :" ",} ] },},],};
donneesdatagrid sont les données que je veux mettre dans ma datagrid

le code du toolkit apres avoir ajouter tratement dans datagrid:


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
(function(){
        var data = donnees;
		var dataStore = new dojo.data.ItemFileWriteStore( {data: data} );
 
		var gridStructure = [
		   [
			 { field: "Mutation", name: "mutation", width: 15, },
			 { field: "Tâches", 	name: "taches", width: 10, }
 
		   ]
		 ]; 		                 
 
		var grid = new dojox.grid.DataGrid({
				id: "grid",
				jsid: "grid",
				store: dataStore,
                autoHeight:true,
                autoWidth:true,
				selectable:true,
                structure: gridStructure
			});
 
		 grid.placeAt("DataGrid");
		 grid.startup(); 
 
	})();
 
(function($){
	var _stuffMoving = false;
	var _started = false;
	var _stalltime = 650; // ms
	var _doneAnim = null;
	var _needed = null;
	var _loaded = [];
	var _connects = [];
	var profileWidget = null;
	var stack = null;
	var timer = null;
	var _profiletimer = null;
 
	var _doneAnim = function(){
 
		$.fadeOut({ 
			node: "overlay", 
			duration: 300,
			onEnd: function(){
				$.animateProperty({
					node:"imageContainer", 
					properties: {
						height: 240,
						opacity:1
					},
					// with teh sexy
					easing: $.fx.easing.backOut,
					duration:420,
					delay:600,
					onEnd: function(){
						$.style("overlay","display","none");
						_started = true;	
						$.query(".startsHidden")
							.style("opacity", "0")
							.removeClass("startsHidden")
							.fadeIn().play(500);
					}
				}).play(); 
			}
		}).play();
 
	};
 
	// onShow result, it no timer was running (see later)
	var updateProfile = function(datawidget){
		_stuffMoving = true;
		stack.selectChild(datawidget._avatar);
		profileWidget.setData(datawidget._userInfo);
	}
 
	var _oneBroke = function(n,e){
		_gotOne(n,e);
	};
 
	var _gotOne = function(n,e){
		_loaded.push(n);
		if(_loaded.length >= $._neededImages){
			$.forEach(_connects, $.disconnect);
			_doneAnim();			
		}
	};
 
	// the onLoad function
	var init = function(){
		$.style("whoNode","opacity", 1);
 
		// see, the page "degrades" ;) . This contributor listing page is only a link to
		// http://dojo.jot.com/ContrbutorListing
		$.query("a[href^=http://dojo.jot]").forEach(function(n){ 
			n.parentNode.innerHTML = n.innerHTML; 
		});
 
		// create a "help" dialog out of the node in the page.
		var dialog = new dijit.Dialog({
			dimensions:[640,420]
		},"dialogProfil");
 
		dialog.startup();
 
		// setup a way to show it
		$.connect($.byId("helper"), "onclick", dialog, "show");
 
		// set it all off: grab some data from a remote file, and create
		// the interface
		(function(){		
        		var data ={"items": 
[ 
{
"imgUrl" :"images/users/toto.jpg",
"name" :"",
"location" :"",
"employer": "",
"website" :"Définition métier  Qui a visité deux fois le site ou l un des sites de la marque Définition technique",
"donneesdatagrid": {"items": [ {"mutation" :"","taches" :"",} ] },
},
{
"imgUrl" :"images/users/toto1.jpg",
"name" :"",
"location" :"",
"employer": "",
"website" :"Définition métier  Qui a visité deux fois le site ou l un des sites de la marque Définition technique",
"donneesdatagrid": {"items": [ {"mutation" :"","taches" :"",} ] },
},
{
"imgUrl" :"images/users/toto2.jpg",
"name" :"",
"location" :"",
"employer": "",
"website" :"Définition métier  Qui a visité deux fois le site ou l un des sites de la marque Définition technique",
"donneesdatagrid": {"items": [ {"mutation" :"","taches" :"",} ] },
},
],
};
 
				var labelNode = $.byId("whoNode");
				var _lastNode = null;
 
				profileWidget = new profile.Data({},"profileData");
 
				// create the region where the avatars will live.
				stack = new dojox.layout.RadioGroupSlide({
					style:"width:180px; height:200px",
					// FIXME: when did StackContainer start setting relative explicitly?
					_setupChild: function(/*Widget*/ page){
						$.style(page.domNode,{
							display:"none",
							position:"absolute",
							overflow:"hidden"
						})
						return page; // dijit._Widget
					}						
				},"stack");
 
				// iterate over each of the returned committers, setting up the canvas
				$.forEach(data.items,function(user, i){
 
					// create an Image in the container, and store the user profile data 
					// in it's instance.
 
					var im = new image.Skewed({ 
						// use a default square.png if no imgUrl found.
						imgUrl: user.imgUrl || "images/square.png",
						value: user.name
 
					});
					$.mixin(im,{ _userInfo: user });
 
					// create a reflection-less scale thumbnail (color) in a div
					var node = $.doc.createElement('div');
					stack.containerNode.appendChild(node);
					node.innerHTML = "<img src='imageReflect.php?spread=0.01&thumbsize=165&src=" + im.imgUrl + "' />";
 
					// and make it a child of our RadioGroupSlide
					var avatar = new dijit.layout.ContentPane({
						id: im.id + "avatar",
						slideFrom:"top"
					}, node);
 
					// mix a reference to the child of the stackContianer in the image widget
					$.mixin(im, { _avatar: avatar });
 
					// store a ref to our "center" image
					if(i === 0){ _lastNode = im; }
 
					// either add this image to the beginning or append to the end. alternate.
					if(i % 2 == 0){
						$.byId("imageContainer").appendChild(im.domNode);
					}else{
						$.place(im.domNode, "imageContainer", "first");
					}
 
				});
				// this will setup all the children we _just_ added
				stack.startup();
 
				// turn the container holding all the image widgets into the interface
				var ic = new image.Container({
					// for performance (it's a big list/lot of images)
					offOpacity:1, 
					onShow: function(widget){
						// onShow fires _every_ time an image is "centered" visually (no skew)
						// so for UX, we'll defer the "updateProfile()" call until some delay,
						if(timer){ clearTimeout(timer); }
						timer = setTimeout($.partial(updateProfile, widget), _stalltime);
						// but still update one label from our widget data
						labelNode.innerHTML = widget.value + "";
						$.anim("profileArea",{ opacity:0 }, 175); 
					},
 
					visibleItems: 42,
					// tweak as needed
					spacing:25,
					angle:10
				},"imageContainer");
 
				var _needed = $.query("img", "imageContainer");
				$._neededImages = Number(_needed.length);
 
				_needed.forEach(function(n,i){
					_connects.push($.connect(n, "globalEvent", $.partial(_gotOne, n)));
					_connects.push($.connect(n, "globalEvent", $.partial(_oneBroke, n)));
					if($.isIE){ n.src = n.src; }				
				});
 
				ic.startup();
				_lastNode.center(); // center the first node (from above creating image widgets)
 
				// resize the image container when the window does, it's fluid 
				$.connect(window, "onresize", ic, "resize");
 
				// make it small, so we can wipe it in
				$.style("imageContainer",{ height:"1px", opacity:1 });
		})();
	};
 
	declare("profile.Stalker", dijit._Widget, {
		constructor: function(){
 
		}
	});
 
	declare("profile.Data", dijit._Widget, {
 
		constructor: function(){
			var $$ = $.byId;
			this.nodeReferences = {
				"location"       : $$("prolocation"),
				"website"        : $$("prowebsite"), 
                "employer"       : $$("proEmployer"),				
			}
		}, 
 
		setData: function(data){
			var node = this.nodeReferences;
 
			for(var i in node){
				if(i in data){
					$.style(node[i],"display","");
					var txt = (
						i == "website" ? 
							"<a href='" + data[i] + "'>" + data[i] + "</a><br>"   : 
							data[i]
					);
					node[i].innerHTML = txt;
				}else{
					$.style(node[i],"display","none");
				}
			}
 
			$.anim("profileArea",{ 
				opacity:{ start:0, end: 0.99 }, 
				paddingLeft:{ start:72, end:0 } }, 520, $.fx.easing.bounceOut
			); 
		}
	});
 
	var newp = function(){
		// IE6 branch of this demo
		window.location.href = "http://" + (confirm("Hi IE6 user! Is it 2008?") ? "webkit.org" : "mozilla.org") + "/";
	}
 
	// setup our branch launch: ;) 
	$.addOnLoad(($.isIE < 7 ? newp() : init()));
 
})(dojo);
code html

Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<div class="tundra">
 
	<div  id="wrapper">
		<div  id="header" class="centered">
			<div  id="helper" class="centered"></div>
			<h1 class="pageHeading" align="center"></h1>
		</div>
		<div id="imageContainer"></div>
		<div  id="content"><div class="centered">
			<div  id="gmap" ></div>
			<div   id="profile">
				<div  class="profileWrapper " >
					<div  class="contentContainer" >
					  <div  class="imageColumn"  >
						<div   id="avatar" class="" >
							<div  id="stack" ></div>
						</div>
					  </div>
					  <div class="detailsColumn" >
						<div  class="contribName " id="whoNode" ></div>
						<div  class="personalDetails"  id="profileArea" >
						<span id="proEmployer"></span><br />
					   <br />
						  <div  class="label" >location : </div>
						  <span  id="prolocation" ></span> <br />
						  <div  class="label" >website:</div>
						  <span id="prowebsite"></span><br />
 
						   <div id="DataGrid" ></div>     
						<div  class="infoParagraph" > &quot;<span id="proInfo"></span>&quot;</div>
						<ul id="profileData"></ul>	
					  </div>
					</div>
				</div>
			</div>
		</div></div>
	</div>
	<div  id="companies"><ul id="roller"></ul></div>
 
</div>

Merci d'avance si vous pouviez m'aider