_f.FormGrid = function(field) { this.field = field; this.doctype = field.df.options; if(!this.doctype) { show_alert('No Options for table ' + field.df.label); } this.col_break_width = cint(this.field.col_break_width); if(!this.col_break_width) this.col_break_width = 100; $y(field.parent,{marginTop:'8px'}); this.init(field.parent, field.df.width); this.setup(); } _f.FormGrid.prototype = new _f.Grid(); _f.FormGrid.prototype.setup = function() { this.make_columns(); } _f.FormGrid.prototype.make_tbar_link = function(parent, label, fn, icon) { var div = $a(parent,'div','',{cursor:'pointer'}); var t = make_table(div, 1, 2, '90%', ['20px',null]); var img = $a($td(t,0,0),'div','wn-icon ' + icon); $y($td(t,0,0),{textAlign:'right'}); var l = $a($td(t,0,1),'span','link_type',{color:'#333'}); l.style.fontSize = '11px'; l.innerHTML = label; div.onclick = fn; div.show = function() { $ds(this); } div.hide = function() { $dh(this); } $td(t,0,0).isactive = 1; $td(t,0,1).isactive = 1; l.isactive = 1; div.isactive = 1; img.isactive = 1; return div; } _f.FormGrid.prototype.make_buttons = function() { var me = this; this.tbar_btns = {}; this.tbar_btns['Del'] = this.make_tbar_link($td(this.tbar_tab,0,0),'Del', function() { me.delete_row(); }, 'ic-round_minus'); this.tbar_btns['Ins'] = this.make_tbar_link($td(this.tbar_tab,0,1),'Ins', function() { me.insert_row(); }, 'ic-round_plus'); this.tbar_btns['Up'] = this.make_tbar_link($td(this.tbar_tab,0,2),'Up', function() { me.move_row(true); }, 'ic-arrow_top'); this.tbar_btns['Dn'] = this.make_tbar_link($td(this.tbar_tab,0,3),'Dn', function() { me.move_row(false); }, 'ic-arrow_bottom'); for(var i in this.btns) this.btns[i].isactive = true; } _f.FormGrid.prototype.make_columns = function() { var gl = fields_list[this.field.df.options]; if(!gl) { alert('Table details not found "'+this.field.df.options+'"'); } gl.sort(function(a,b) { return a.idx - b.idx}); var p = this.field.perm; for(var i=0;i