summaryrefslogtreecommitdiffstats
path: root/web/widget/table/header.js
blob: 5a0ac6f966a91f556494b9f935a841293a2461fd (plain)
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
/*
 * Copyright (c) 2012-2014 Kaarle Ritvanen
 * See LICENSE file for license details
 */

define(["acf2/widget/table/row", "jquery"], function(Base, $) {
    return Base.extend({
	init: function(
	    data, name, meta, level, editable, removable
	) {
	    this.header = $("<tr>");
	    var table = $("<table>");
	    table.append($("<thead>").html(this.header));
	    table.append($("<tbody>").html(
		Base.init.call(
		    this,
		    data,
		    name,
		    meta,
		    level,
		    editable,
		    removable
		)
	    ));
	    return table;
	},
	
	appendWidget: function(el, label) {
	    this.header.append($("<th>").text(label));
	    return Base.appendWidget.call(this, el, label);
	}
    });
});