質問編集履歴
2
activateTdEditorの編集に関するコメントを追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -319,3 +319,23 @@
|
|
319
319
|
}
|
320
320
|
|
321
321
|
```
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
activateTdEditorも自由に変更可能です。
|
326
|
+
|
327
|
+
記載したソースではダミーの処理をしていますが、実際のコードでもさほど変わらず、エディタにセル内の値を食わせてエディタ起動しているだけです。
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
以下動作サンプルです。
|
332
|
+
|
333
|
+
●エディタなし版
|
334
|
+
|
335
|
+
http://amicolo.net/make-table/index4.html
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
●エディタあり版
|
340
|
+
|
341
|
+
http://amicolo.net/make-table/index5.html
|
1
activateTdEditor を追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -106,8 +106,6 @@
|
|
106
106
|
|
107
107
|
```
|
108
108
|
|
109
|
-
|
110
|
-
|
111
109
|
```HTML
|
112
110
|
|
113
111
|
<div id="table-edit-area">
|
@@ -187,3 +185,137 @@
|
|
187
185
|
|
188
186
|
|
189
187
|
```
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
以下を追記いたしました。
|
192
|
+
|
193
|
+
```javascript
|
194
|
+
|
195
|
+
/*-------------------------
|
196
|
+
|
197
|
+
* エディタ起動
|
198
|
+
|
199
|
+
---------------------------*/
|
200
|
+
|
201
|
+
function activateTdEditor(target, html){
|
202
|
+
|
203
|
+
//モーダルウィンドウ表示位置調整
|
204
|
+
|
205
|
+
centeringModalPosition(target);
|
206
|
+
|
207
|
+
//モーダルウィンドウ表示
|
208
|
+
|
209
|
+
modalOpen(target);
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
//エディタ起動
|
214
|
+
|
215
|
+
$('#edit_box').html(html);
|
216
|
+
|
217
|
+
//ダミーとして編集したことにする
|
218
|
+
|
219
|
+
$('#edit_box').append('ああああああ');
|
220
|
+
|
221
|
+
}
|
222
|
+
|
223
|
+
/*-------------------------
|
224
|
+
|
225
|
+
* モーダルウィンドウを開く
|
226
|
+
|
227
|
+
---------------------------*/
|
228
|
+
|
229
|
+
function modalOpen(modalId){
|
230
|
+
|
231
|
+
$(modalId).css('display', 'block');
|
232
|
+
|
233
|
+
$('#modal-overlay').css('display', 'block');
|
234
|
+
|
235
|
+
}
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
/*-------------------------
|
240
|
+
|
241
|
+
* モーダルウィンドウを閉じる
|
242
|
+
|
243
|
+
---------------------------*/
|
244
|
+
|
245
|
+
function modalClose(modalId){
|
246
|
+
|
247
|
+
$('#modal-overlay').css('display', 'none');
|
248
|
+
|
249
|
+
$(modalId).css('display', 'none');
|
250
|
+
|
251
|
+
}
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
/*-------------------------
|
256
|
+
|
257
|
+
* モーダルウィンドウの表示位置調整
|
258
|
+
|
259
|
+
---------------------------*/
|
260
|
+
|
261
|
+
function centeringModalPosition(modalId){
|
262
|
+
|
263
|
+
//画面幅取得
|
264
|
+
|
265
|
+
var w = $(window).width();
|
266
|
+
|
267
|
+
//画面高さ取得
|
268
|
+
|
269
|
+
var h = $(window).height();
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
//モーダルウィンドウの幅取得
|
274
|
+
|
275
|
+
var cw = $(modalId).outerWidth(true);
|
276
|
+
|
277
|
+
//モーダルウィンドウの高さ取得
|
278
|
+
|
279
|
+
var ch = $(modalId).outerHeight(true);
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
//モーダルウィンドウの横位置計算
|
286
|
+
|
287
|
+
var pxleft = ((w - cw)/2);
|
288
|
+
|
289
|
+
//モーダルウィンドウの縦位置計算
|
290
|
+
|
291
|
+
var pxtop = ((h - ch)/2);
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
$(modalId).css({"left": pxleft + "px"});
|
296
|
+
|
297
|
+
$(modalId).css({"top": pxtop + "px"});
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
}
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
function debugPrintIndex(e){
|
306
|
+
|
307
|
+
//行番号取得
|
308
|
+
|
309
|
+
var row = $(e.target).closest('tr').index();
|
310
|
+
|
311
|
+
//列番号取得
|
312
|
+
|
313
|
+
var col = e.target.cellIndex;
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
console.log('行:列 = ' + row + ':' + col);
|
318
|
+
|
319
|
+
}
|
320
|
+
|
321
|
+
```
|