Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

listing.js 18 KiB

13 anni fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. // Listing
  2. // this listing object will soon be
  3. // deprecated because it has a very non standard way of creation
  4. // the new listing object is at wn.widgets.Listing
  5. // -----------------------
  6. list_opts = {
  7. cell_style : {padding:'3px 2px'},
  8. alt_cell_style : {},
  9. head_style : {height:'20px',overflow:'hidden',verticalAlign:'middle',fontWeight:'bold',padding:'1px',fontSize:'13px'},
  10. head_main_style : {padding:'0px'},
  11. hide_export : 1,
  12. hide_print : 1,
  13. hide_refresh : 0,
  14. hide_rec_label: 0,
  15. show_calc: 1,
  16. show_empty_tab : 0,
  17. no_border: 1,
  18. append_records: 1,
  19. table_width: null
  20. };
  21. // -------------------------------------------------------
  22. function Listing(head_text, no_index, no_loading) {
  23. wn.require('lib/js/legacy/widgets/form/fields.js');
  24. this.start = 0;
  25. this.page_len = 20;
  26. this.filters_per_line = 7;
  27. this.cell_idx = 0;
  28. this.head_text = head_text ? head_text : 'Result';
  29. this.keyword = 'records';
  30. this.no_index = no_index;
  31. this.underline = 1;
  32. this.no_rec_message = 'No Result';
  33. // interfaces
  34. // show_cell(cell, cell_id, data) - override cell display
  35. // show_result()
  36. // server_call(srs, call_back) - override query function
  37. this.show_cell = null;
  38. this.show_result = null;
  39. this.colnames = null; // sr num is required
  40. this.colwidths = null;
  41. this.coltypes = null;
  42. this.coloptions = null;
  43. this.filters = {};
  44. this.sort_list = {};
  45. this.sort_order_dict = {};
  46. this.sort_heads = {};
  47. this.is_std_query = false;
  48. this.server_call = null;
  49. this.no_loading = no_loading;
  50. this.opts = copy_dict(list_opts);
  51. }
  52. // -------------------------------------------------------
  53. Listing.prototype.make = function(parent) {
  54. var me = this;
  55. this.wrapper = parent;
  56. // filter
  57. this.filter_wrapper = $a(parent, 'div', 'srs_filter_wrapper');
  58. this.filter_area = $a(this.filter_wrapper, 'div', 'srs_filter_area');
  59. $dh(this.filter_wrapper);
  60. this.btn_area = $a(parent, 'div', '', {margin:'8px 0px'});
  61. this.body_area = $a(parent,'div','srs_body_area');
  62. if(!this.opts.hide_rec_label)
  63. this.rec_label = $a(this.body_area, 'div', '', {margin:'4px 0px',color:'#888'});
  64. // results
  65. this.results = $a($a(this.body_area, 'div','srs_results_area'),'div');
  66. this.fetching_area = $a(this.body_area, 'div','',{height:'120px', background:'url("lib/images/ui/square_loading.gif") center no-repeat', display:'none'});
  67. this.show_no_records = $a(this.body_area,'div','',{margin:'200px 0px', textAlign:'center', fontSize:'14px', color:'#888', display:'none'});
  68. this.show_no_records.innerHTML = 'No Result';
  69. // empty table (old style)
  70. if(this.opts.show_empty_tab)
  71. this.make_result_tab();
  72. this.bottom_div = $a(this.body_area,'div','',{paddingTop:'8px'});
  73. this.make_toolbar();
  74. }
  75. // -------------------------------------------------------
  76. Listing.prototype.make_toolbar = function() {
  77. var me = this;
  78. this.buttons = {};
  79. // buttons
  80. var make_btn = function(label,icon,onclick,bold) {
  81. var btn = $btn(me.btn_area,label,onclick,{marginRight:'4px'});
  82. if(bold)$y(btn,{fontWeight: 'bold'});
  83. me.buttons[label] = btn;
  84. }
  85. // refresh btn
  86. if(!this.opts.hide_refresh) {
  87. make_btn('Refresh','ui-icon-refresh',function(btn) {
  88. me.start = 0;
  89. me.run();
  90. },1);
  91. }
  92. // new
  93. if(this.opts.show_new) {
  94. make_btn('New ','ui-icon-document',function() { new_doc(me.dt); },1);
  95. }
  96. // report
  97. if(this.opts.show_report) {
  98. make_btn('Report Builder','ui-icon-clipboard',function() { loadreport(me.dt, null, null, null, 1); },0);
  99. }
  100. // export
  101. if(!this.opts.hide_export) {
  102. make_btn('Export','ui-icon-circle-arrow-e',function() {me.do_export();});
  103. }
  104. // print
  105. if(!this.opts.hide_print) {
  106. make_btn('Print','ui-icon-print',function() {me.do_print();});
  107. }
  108. // calc
  109. if(this.opts.show_calc) {
  110. make_btn('Calc','ui-icon-calculator',function() {me.do_calc();});
  111. $dh(me.buttons['Calc'])
  112. }
  113. this.loading_img = $a(this.btn_area,'img','',{display:'none',marginBottom:'-2px'});
  114. this.loading_img.src = 'lib/images/ui/button-load.gif';
  115. if(!keys(this.buttons).length)
  116. $dh(this.btn_area);
  117. }
  118. // -------------------------------------------------------
  119. Listing.prototype.do_print = function() {
  120. this.build_query();
  121. if(!this.query) { alert('No Query!'); return; }
  122. args = {
  123. query:this.query,
  124. title:this.head_text,
  125. colnames:this.colnames,
  126. colwidths:this.colwidths,
  127. coltypes:this.coltypes,
  128. has_index:(this.no_index ? 0 : 1),
  129. has_headings: 1,
  130. check_limit:1,
  131. is_simple:1
  132. }
  133. wn.require('lib/js/legacy/widgets/print_query.js');
  134. _p.print_query = new _p.PrintQuery();
  135. _p.print_query.show_dialog(args);
  136. }
  137. // -------------------------------------------------------
  138. Listing.prototype.do_calc = function() {
  139. show_calc(this.result_tab, this.colnames, this.coltypes, 0)
  140. }
  141. // -------------------------------------------------------
  142. Listing.prototype.add_filter = function(label, ftype, options, tname, fname, cond) {
  143. if(!this.filter_area){alert('[Listing] make() must be called before add_filter');}
  144. var me = this;
  145. // create filter area
  146. if(!this.filter_set) {
  147. // actual area
  148. var h = $a(this.filter_area, 'div', '', {fontSize:'14px', fontWeight:'bold', marginBottom:'4px'});
  149. h.innerHTML = 'Filter your search';
  150. this.filter_area.div = $a(this.filter_area, 'div');
  151. this.perm = [[1,1],]
  152. this.filters = {};
  153. }
  154. $ds(this.filter_wrapper);
  155. // create new table (or new line)
  156. if((!this.inp_tab) || (this.cell_idx==this.filters_per_line)) {
  157. this.inp_tab = $a(this.filter_area.div, 'table','',{width:'100%', tableLayout:'fixed'});
  158. this.inp_tab.insertRow(0);
  159. for(var i=0;i<this.filters_per_line;i++) {
  160. this.inp_tab.rows[0].insertCell(i);
  161. }
  162. this.cell_idx = 0;
  163. }
  164. var c= this.inp_tab.rows[0].cells[this.cell_idx];
  165. this.cell_idx++;
  166. $y(c,{width:cint(100/this.filters_per_line) + '%',textAlign:'left',verticalAlign:'top'});
  167. // filter label
  168. var d1= $a(c,'div','',{fontSize:'11px', marginBottom:'2px'}); d1.innerHTML = label;
  169. if(ftype=='Link') d1.innerHTML += ' <img src="lib/images/icons/link.png" style="margin-bottom:-5px" title="Link">';
  170. var d2= $a(c,'div');
  171. // create the filter
  172. if(in_list(['Text', 'Small Text', 'Code', 'Text Editor','Read Only'],ftype))
  173. ftype='Data';
  174. // add empty option in select (if missing)
  175. if(ftype=='Select' && !in_list(options.split('\n'), '')) options = '\n'+options
  176. var inp = make_field({fieldtype:ftype, 'label':label, 'options':options, no_buttons:1}, '', d2, this, 0, 1);
  177. inp.not_in_form = 1;
  178. inp.report = this;
  179. // filter style
  180. inp.df.single_select = 1;
  181. inp.parent_cell = c;
  182. inp.parent_tab = this.input_tab;
  183. $y(inp.wrapper,{width:'95%'});
  184. inp.refresh();
  185. //if(!inp.input.custom_select && !inp.input.txt)
  186. // $y(inp.input,{width:'100%'});
  187. inp.tn = tname; inp.fn = fname; inp.condition = cond;
  188. var me = this;
  189. inp.onchange = function() { me.start = 0; }
  190. this.filters[label] = inp;
  191. this.filter_set = 1;
  192. }
  193. // -------------------------------------------------------
  194. Listing.prototype.remove_filter = function(label) {
  195. var inp = this.filters[label];
  196. inp.parent_tab.rows[0].deleteCell(inp.parent_cell.cellIndex);
  197. delete this.filters[label];
  198. }
  199. // -------------------------------------------------------
  200. Listing.prototype.remove_all_filters = function() {
  201. for(var k in this.filters) this.remove_filter(k);
  202. $dh(this.filter_wrapper);
  203. }
  204. Listing.prototype.add_sort = function(ci, fname) { this.sort_list[ci]=fname; }
  205. Listing.prototype.has_data = function() { return this.n_records; }
  206. // -------------------------------------------------------
  207. Listing.prototype.set_default_sort = function(fname, sort_order) {
  208. this.sort_order = sort_order;
  209. this.sort_order_dict[fname] = sort_order;
  210. this.sort_by = fname;
  211. if(this.sort_heads[fname])
  212. this.sort_heads[fname].set_sorting_as(sort_order);
  213. }
  214. // -------------------------------------------------------
  215. Listing.prototype.set_sort = function(cell, ci, fname) {
  216. var me = this;
  217. $y(cell.sort_cell,{width:'18px'});
  218. cell.sort_img = $a(cell.sort_cell, 'img');
  219. cell.fname = fname;
  220. $dh(cell.sort_img);
  221. cell.set_sort_img = function(order) {
  222. var t = 'images/icons/sort_desc.gif';
  223. if(order=='ASC') {
  224. t = 'images/icons/sort_asc.gif';
  225. }
  226. this.sort_img.src = t;
  227. }
  228. cell.set_sorting_as = function(order) {
  229. // set values for query building
  230. me.sort_order = order;
  231. me.sort_by = this.fname
  232. me.sort_order_dict[this.fname] = order;
  233. // set the image
  234. this.set_sort_img(order)
  235. // deselect active
  236. if(me.cur_sort) {
  237. $y(me.cur_sort, {backgroundColor:"#FFF"});
  238. $dh(me.cur_sort.sort_img);
  239. }
  240. // set at active
  241. me.cur_sort = this;
  242. $y(this, {backgroundColor:"#DDF"});
  243. $di(this.sort_img);
  244. }
  245. $y(cell.label_cell,{color:'#44A',cursor:'pointer'});
  246. // set default image
  247. cell.set_sort_img(me.sort_order_dict[fname] ? me.sort_order_dict[fname] : 'ASC');
  248. cell.onmouseover = function() {
  249. $di(this.sort_img);
  250. }
  251. cell.onmouseout = function() {
  252. if(this != me.cur_sort)
  253. $dh(this.sort_img);
  254. }
  255. cell.onclick = function() {
  256. // switch
  257. this.set_sorting_as((me.sort_order_dict[fname]=='ASC') ? 'DESC' : 'ASC');
  258. // run
  259. me.run();
  260. }
  261. this.sort_heads[fname] = cell;
  262. }
  263. // -------------------------------------------------------
  264. Listing.prototype.do_export = function() {
  265. this.build_query();
  266. var me = this;
  267. me.cn = [];
  268. if(this.no_index)
  269. me.cn = this.colnames; // No index
  270. else {
  271. for(var i=1;i<this.colnames.length;i++)
  272. me.cn.push(this.colnames[i]); // Ignore the SR label
  273. }
  274. var q = export_query(this.query,
  275. function(query) {
  276. export_csv(query, me.head_text, null, 1, null, me.cn);
  277. });
  278. }
  279. // -------------------------------------------------------
  280. Listing.prototype.build_query = function() {
  281. if(this.get_query)this.get_query(this);
  282. if(!this.query) { alert('No Query!'); return; }
  283. if(!this.prefix) this.prefix = 'tab';
  284. // add filters
  285. var cond = [];
  286. for(var i in this.filters) {
  287. var f = this.filters[i];
  288. var val = f.get_value();
  289. var c = f.condition;
  290. if(!c)c='=';
  291. if(val && c.toLowerCase()=='like')val += '%';
  292. if(f.tn && val && !in_list(['All','Select...',''],val))
  293. cond.push(repl(' AND `%(prefix)s%(dt)s`.%(fn)s %(condition)s "%(val)s"', {
  294. prefix: this.prefix, dt:f.tn, fn:f.fn, condition:c, val:val}));
  295. }
  296. if(cond) {
  297. this.query += NEWLINE + cond.join(NEWLINE)
  298. if(this.query_max)
  299. this.query_max += NEWLINE + cond.join(NEWLINE)
  300. }
  301. // add grouping
  302. if(this.group_by)
  303. this.query += ' ' + this.group_by + ' ';
  304. // add sorting
  305. if(this.sort_by && this.sort_order) {
  306. this.query += NEWLINE + ' ORDER BY `' + this.sort_by + '` ' + this.sort_order;
  307. }
  308. if(this.show_query) msgprint(this.query);
  309. }
  310. // -------------------------------------------------------
  311. Listing.prototype.set_rec_label = function(total, cur_page_len) {
  312. if(this.opts.hide_rec_label)
  313. return;
  314. else if(total==-1)
  315. this.rec_label.innerHTML = 'Fetching...'
  316. else if(total > 0)
  317. this.rec_label.innerHTML = repl('Total %(total)s %(keyword)s. Showing %(start)s to %(end)s', {total:total,start:cint(this.start)+1,end:cint(this.start)+cint(cur_page_len), keyword:this.keyword});
  318. else if(total==null)
  319. this.rec_label.innerHTML = ''
  320. else if(total==0)
  321. this.rec_label.innerHTML = this.no_rec_message;
  322. }
  323. // -------------------------------------------------------
  324. Listing.prototype.run = function(run_callback) {
  325. this.build_query();
  326. var q = this.query;
  327. var me = this;
  328. // add limits
  329. if(this.max_len && this.start>=this.max_len) this.start-= this.page_len;
  330. q += ' LIMIT ' + this.start + ',' + this.page_len;
  331. // callback
  332. var call_back = function(r,rt) {
  333. $dh(me.loading_img);
  334. // show results
  335. me.max_len = r.n_values;
  336. // result!
  337. if(r.values && r.values.length) {
  338. me.n_records = r.values.length;
  339. var nc = r.values[0].length;
  340. if(me.colwidths) nc = me.colwidths.length-(me.no_index?0:1); // -1 for sr no
  341. // redraw table
  342. if(me.opts.append_records && me.start!=0) {
  343. // add columns
  344. me.append_rows(r.values.length);
  345. } else {
  346. me.clear_tab();
  347. if(!me.show_empty_tab) {
  348. me.remove_result_tab();
  349. me.make_result_tab(r.values.length);
  350. }
  351. }
  352. me.refresh(r.values.length, nc, r.values, r.n_values);
  353. me.total_records = r.n_values;
  354. me.set_rec_label(r.n_values, r.values.length);
  355. // no result
  356. } else {
  357. me.n_records = 0;
  358. me.set_rec_label(0);
  359. me.clear_tab();
  360. if(!me.opts.append_records) {
  361. if(me.show_empty_tab) {
  362. me.clear_tab();
  363. } else {
  364. me.remove_result_tab();
  365. me.make_result_tab(0);
  366. if(me.opts.show_no_records_label) {
  367. $ds(me.show_no_records);
  368. }
  369. }
  370. }
  371. }
  372. $ds(me.results);
  373. if(run_callback)run_callback();
  374. if(me.onrun) me.onrun();
  375. }
  376. // run
  377. $dh(me.show_no_records);
  378. this.set_rec_label(-1);
  379. $di(this.loading_img);
  380. if(this.server_call) {
  381. this.server_call(this, call_back);
  382. } else {
  383. args={ query_max: (this.query_max ? this.query_max : '') }
  384. if(this.is_std_query) args.query = q;
  385. else args.simple_query = q;
  386. if(this.opts.formatted) args.formatted = 1;
  387. $c('webnotes.widgets.query_builder.runquery', args, call_back, null, this.no_loading);
  388. }
  389. }
  390. // -------------------------------------------------------
  391. Listing.prototype.remove_result_tab = function() {
  392. if(!this.result_tab) return;
  393. this.result_tab.parentNode.removeChild(this.result_tab);
  394. delete this.result_tab;
  395. }
  396. // -------------------------------------------------------
  397. Listing.prototype.reset_tab = function() {
  398. this.remove_result_tab();
  399. this.make_result_tab();
  400. }
  401. // -------------------------------------------------------
  402. Listing.prototype.make_result_tab = function(nr) {
  403. if(this.result_tab)return;
  404. if(!this.colwidths) alert("Listing: Must specify column widths");
  405. var has_headrow = this.colnames ? 1 : 0;
  406. if(nr==null)nr = this.page_len;
  407. nr += has_headrow;
  408. var nc = this.colwidths.length;
  409. var t=make_table(this.results, nr, nc, (this.opts.table_width ? this.opts.table_width : '100%'), this.colwidths,{padding:'0px'});
  410. t.className = 'srs_result_tab'; this.result_tab = t;
  411. $y(t,{borderCollapse:'collapse'});
  412. if(this.opts.table_width) {
  413. $y(this.results, {overflowX:'auto'});
  414. $y(t,{tableLayout:'fixed'});
  415. }
  416. // display headings
  417. if(has_headrow) {
  418. this.make_headings(t,nr,nc);
  419. // hilight sorted cell
  420. if(this.sort_by && this.sort_heads[this.sort_by]) {
  421. this.sort_heads[this.sort_by].set_sorting_as(this.sort_order);
  422. }
  423. }
  424. // style
  425. this.set_table_style();
  426. if(this.opts.no_border == 1) {
  427. $y(t,{border:'0px'});
  428. }
  429. this.result_tab = t;
  430. }
  431. // -------------------------------------------------------
  432. Listing.prototype.set_table_style = function() {
  433. // set style
  434. var t = this.result_tab;
  435. for(var ri=(this.colnames?1:0); ri<t.rows.length; ri++) {
  436. for(var ci=0; ci<t.rows[ri].cells.length; ci++) {
  437. // default style
  438. if(this.opts.cell_style)$y($td(t,ri,ci), this.opts.cell_style);
  439. // color alternate rows (itunes style)
  440. if(this.opts.alt_cell_style && (ri % 2))$y($td(t,ri,ci), this.opts.alt_cell_style);
  441. // show blank empty cells
  442. if(this.opts.show_empty_tab && !$td(t, ri, ci).innerHTML)$td(t, ri, ci).innerHTML = '&nbsp;';
  443. }
  444. }
  445. }
  446. // -------------------------------------------------------
  447. Listing.prototype.append_rows = function(nr) {
  448. for(var i=0; i<nr; i++) { append_row(this.result_tab); }
  449. this.set_table_style();
  450. }
  451. // -------------------------------------------------------
  452. Listing.prototype.clear_tab = function() {
  453. $dh(this.results);
  454. if(this.result_tab) {
  455. var nr = this.result_tab.rows.length;
  456. var nc = this.result_tab.rows[0].cells.length;
  457. for(var ri=(this.colnames?1:0); ri<nr; ri++)
  458. for(var ci=0; ci < nc; ci++)
  459. $td(this.result_tab, ri, ci).innerHTML = (this.opts.show_empty_tab ? '&nbsp;' : '');
  460. }
  461. }
  462. // -------------------------------------------------------
  463. Listing.prototype.clear = function() {
  464. this.rec_label.innerHTML = '';
  465. this.clear_tab();
  466. }
  467. // -------------------------------------------------------
  468. Listing.prototype.refresh_calc = function() {
  469. if(!this.opts.show_calc) return;
  470. if(has_common(this.coltypes, ['Currency','Int','Float'])) {
  471. $di(this.buttons['Calc']);
  472. } else {
  473. $dh(this.buttons['Calc']);
  474. }
  475. }
  476. // -------------------------------------------------------
  477. Listing.prototype.refresh = function(nr, nc, d, n_values) {
  478. this.refresh_more_button(nr, n_values);
  479. this.refresh_calc();
  480. if(this.show_result)
  481. this.show_result();
  482. else {
  483. if(nr) {
  484. // Standard Result Display
  485. var start = this.result_tab.rows.length - nr;
  486. // display results
  487. for(var ri=start ; ri<start+nr ; ri++) {
  488. var c0 = $td(this.result_tab,ri,0);
  489. // show index
  490. if(!this.no_index) {
  491. c0.innerHTML = cint(this.start) + cint(ri-start) + 1;
  492. }
  493. // columns
  494. for(var ci=0 ; ci<nc ; ci++) {
  495. var c = $td(this.result_tab, ri, ci+(this.no_index?0:1));
  496. if(c) {
  497. c.innerHTML = ''; // clear
  498. if(this.show_cell) this.show_cell(c, ri-start, ci, d);
  499. else this.std_cell(c, ri-start, ci, d);
  500. }
  501. }
  502. }
  503. }
  504. }
  505. }
  506. // -------------------------------------------------------
  507. Listing.prototype.refresh_more_button = function(nr, n_values) {
  508. var me = this;
  509. if(this.more_btn) {
  510. $dh(this.more_btn);
  511. }
  512. if((this.start + nr) == this.max_len || (!this.max_len && nr < this.page_len)) {
  513. // all records shown
  514. } else if(nr) {
  515. if(!this.more_btn) {
  516. // make button
  517. $y(this.bottom_div, {margin:'8px 0px 16px 0px', textAlign:'center'});
  518. this.more_btn = $btn(this.bottom_div, 'Show more results...',
  519. function() {
  520. me.start = me.start + me.page_len;
  521. me.more_btn.set_working();
  522. me.run(function() { me.more_btn.done_working(); });
  523. }, {fontSize:'14px'}, 0, 1);
  524. $y(this.more_btn.loading_img, {marginBottom:'0px'});
  525. }
  526. $di(this.more_btn);
  527. }
  528. }
  529. // -------------------------------------------------------
  530. Listing.prototype.make_headings = function(t,nr,nc) {
  531. for(var ci=0 ; ci<nc ; ci++) {
  532. var tmp = make_table($td(t,0,ci),1,2,'100%',['','0px'],this.opts.head_style);
  533. $y(tmp,{tableLayout:'fixed',borderCollapse:'collapse'});
  534. $y($td(t,0,ci),this.opts.head_main_style); // right border on main table
  535. $td(t,0,ci).sort_cell = $td(tmp,0,1);
  536. $td(t,0,ci).label_cell = $td(tmp,0,0);
  537. $td(tmp,0,1).style.padding = '0px';
  538. $td(tmp,0,0).innerHTML = this.colnames[ci]?this.colnames[ci]:'&nbsp;';
  539. if(this.sort_list[ci])this.set_sort($td(t,0,ci), ci, this.sort_list[ci]);
  540. var div = $a($td(t,0,ci), 'div');
  541. $td(t,0,ci).style.borderBottom ='1px solid #CCC';
  542. if(this.coltypes && this.coltypes[ci] && in_list(['Currency','Float','Int'], this.coltypes[ci])) $y($td(t,0,ci).label_cell,{textAlign:'right'})
  543. }
  544. }
  545. // -------------------------------------------------------
  546. Listing.prototype.std_cell = function(cell, ri, ci, d) {
  547. var has_headrow = this.colnames ? 1 : 0;
  548. cell.div = $a(cell, 'div');
  549. $s(
  550. cell.div,
  551. d[ri][ci],
  552. this.coltypes ? this.coltypes[ci+(this.no_index?0:1)] : null,
  553. this.coloptions ? this.coloptions[ci+(this.no_index?0:1)] : null
  554. );
  555. }