25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

726 satır
20 KiB

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