Return a td with the formated value or action for headers
6614
def render_cell_thead
      if @ask
        cell_value = (@ask.is_a?(Symbol)) ? I18n.t(@ask, {}, :header) : @ask
      else
        cell_value = @block
      end
      if @can_sort
        sort_on = @options[:sort_as] || @ask
        @html_options.merge!(:class => "#{@html_options[:class]} #{sorting_html_class(sort_on)}".strip)
        content_tag(:th, sort_link_to(cell_value, sort_on), @html_options)
      else
        content_tag(:th, cell_value, @html_options)
      end
    end
566626
def td(name, options = {}, &block)
      column_class = options.delete(:using) || Column
      @columns << column_class.new(name, options, &block)
    end
1278010
protected String getHeaderValue(HtmlRenderingContext context, int col, String columnName) {
        return context.escapeHtml(columnName);
    }
836921
def to_format
      if !get? && has_errors? && !response_overridden?
        display_errors
      elsif has_view_rendering? || response_overridden?
        default_render
      else
        api_behavior
      end
    rescue ActionView::MissingTemplate
      api_behavior
    end
1088704
function TableFormatter(options) {
  const table = new Table(options);
  this.format = format;
  function format(result, formatOptions) {
    let data = [];
    _.each(result, function (item) {
      data.push(_.values(_.pick(item, options.values)));
    });
    if (formatOptions.format === 'csv') {
     _.each(data, function(row) {
       console.log(row.join(','));
     });
    } else if ( formatOptions.format === 'json') {
      console.log(JSON.stringify(result));
    } else {
      table.push.apply(table, data);
      console.log(table.toString());
    }
  }
}
1192800
def format(self, method, data):
        '''  '''
        if data is None:
            if method == 'GET':
                raise NotFound()
            return ''

        return self._meta.formatter.format(data)
384887
def click_table_printer(headers, _filter, data):
    """"""
    _filter = [h.lower() for h in _filter] + [h.upper() for h in _filter]
    headers = [h for h in headers if not _filter or h in _filter]
    # Maximum header width
    header_widths = [len(h) for h in headers]

    for row in data:
        for idx in range(len(headers)):
            # If a row contains an element which is wider update maximum width
            if header_widths[idx] < len(str(row[idx])):
                header_widths[idx] = len(str(row[idx]))
    # Prepare the format string with the maximum widths
    formatted_output_parts = ['{{:<{0}}}'.format(hw)
                              for hw in header_widths]
    formatted_output = '   '.join(formatted_output_parts)
    # Print the table with the headers capitalized
    click.echo(formatted_output.format(*[h.upper() for h in headers]))
    for row in data:
        click.echo(formatted_output.format(*row))
970678
function ()
	{
		var aoOpen = this.s.dt.aoOpenRows;
		var iVisible = this.s.dt.oApi._fnVisbleColumns( this.s.dt );

		for ( var i=0, iLen=aoOpen.length ; i<iLen ; i++ ) {
			aoOpen[i].nTr.getElementsByTagName('td')[0].colSpan = iVisible;
		}
	}
1028881
def result_headers(context, cl): 
    
    for i, field_name in enumerate(cl.list_display):
        text, attr = label_for_field(field_name, cl.model, return_attr=True)
        if attr:
            # Potentially not sortable

            # if the field is the action checkbox: no sorting and special class
            if field_name == 'action_checkbox':
                yield {
                    "text": text,
                    "class_attrib": mark_safe(' class="action-checkbox-column"'),
                    "sortable": False,
                }
                continue

#            if other_fields like Edit, Visualize, etc:
                # Not sortable
#                yield {
#                    "text": text,
#                    "class_attrib": format_html(' class="column-{0}"', field_name),
#                    "sortable": False,
#                }
#                continue

        # OK, it is sortable if we got this far
        th_classes = ['sortable', 'column-{0}'.format(field_name)]
        ascending = None
        is_sorted = False
        # Is it currently being sorted on?
        if context.get('current_sort_field') == str(i + 1):
            is_sorted = True
            ascending = False
            th_classes.append('sorted descending')
        elif context.get('current_sort_field') == '-'+str(i + 1):
            is_sorted = True
            ascending = True
            th_classes.append('sorted ascending')

        if 'request' in context:
            url = context['request'].path
        else:
            url = "./"

### TODO: when start using action_checkbox use i instead of i + 1. This +1 is to correct enumerate index
        # builds url
        url += "?sort_by="

        if ascending is False:
            url += "-"
        url += str(i + 1)

        if 'getsortvars' in context:
            extra_vars = context['getsortvars']
        else:
            if 'request' in context:
                request = context['request']
                getvars = request.GET.copy()
                if 'sort_by' in getvars:
                    del getvars['sort_by']
                if len(getvars.keys()) > 0:
                    context['getsortvars'] = "&%s" % getvars.urlencode()
                else:
                    context['getsortvars'] = ''
                extra_vars = context['getsortvars']

        # append other vars to url
        url += extra_vars

        yield {
            "text": text,
            "url": url,
            "sortable": True,
            "sorted": is_sorted,
            "ascending": ascending,
            "class_attrib": format_html(' class="{0}"', ' '.join(th_classes)) if th_classes else '',
        }
1028309
def render_cell_tbody
      if @type == :action
        cell_value = action_link_to(@ask)
      elsif @ask
        cell_value = (@ask.is_a?(Symbol)) ? format_cell_value(@object[@ask], @ask) : format_cell_value(@ask)
      else
        cell_value = @block
      end
      cell_value = action_link_to(@options[:action], cell_value) if @type != :action and @options.has_key?(:action)
      content_tag(:td, cell_value, @html_options)
    end
779753
function selected2format()
			{
				formatFieldSwitch(true);
				
				formatbar.find("a").click(function()
				{
					$("*",this).click(function(e)
					{
						e.preventDefault();
						return false;
					});
					
					formatLabelView($(this).text());
					
					var formatValue = $(this).attr(vars.css + "-formatval"); // the type of format value
					
					// convert to selected format
					selectionSet("formatBlock",'<'+formatValue+'>');
					
					formatFieldSwitch(false);
				});
			}
1326272
function getMethodHtml(method) {
    var params = method.getParams();

    return [
        '<h3>', method.getName(), '</h3>',
        method.getOption('executeOnServerOnly') &&
            '<span class="label label-primary" style="font-size:0.5em;vertical-align:middle">server only</span>',
        '<p>', method.getDescription(), '</p>',
         Object.keys(params).length &&
            [
                '<table class="table table-bordered table-condensed">',
                    '<thead>',
                        '<tr>',
                            '<th class="col-md-2">Name</th>',
                            '<th class="col-md-2">Type</th>',
                            '<th>Description</th>',
                        '</tr>',
                    '</thead>',
                    '<tbody>',
                        Object.keys(params).map(function (key) {
                            return getMethodParamHtml(key, params[key]);
                        }).join(''),
                    '</tbody>',
                '</table>'
            ].join('')
    ].filter(Boolean).join('');
}
259144
def format_row(self, row):
        
        res = []
        headers = getattr(self, 'headers', [])
        for column in headers:
            column_name = column['name']
            value = row.get(column_name, '')
            if hasattr(self, "format_%s" % column_name):
                value = getattr(self, "format_%s" % column_name)(value)
            res.append(value)
        return res
265220
function writeTableHead(browserPlatformType) {
  let browserNameKeys = Object.keys(browsers[browserPlatformType]);
  let output = '';
  if (browserPlatformType === 'webextensions') {
    output = '<table class="webext-summary-compat-table"><thead><tr><th style="width: 40%"></th>'
    let browserColumnWidth = 60/browserNameKeys.length;
    for (let browserNameKey of browserNameKeys) {
      output += `<th style="width:${browserColumnWidth}%">${browsers[browserPlatformType][browserNameKey]}</th>`;
    }
    output += "<tr></thead>";
  } else {
    output = `<div id="compat-${browserPlatformType}"><table class="compat-table"><thead><tr>`;
    output +=  '<th>Feature</th>';
    for (let browserNameKey of browserNameKeys) {
      output += `<th>${browsers[browserPlatformType][browserNameKey]}</th>`;
    }
    output += '</tr></thead>';
  }
  return output;
}
559921
def format_value(field_info, value, section):
    """"""
    if section == "FORMAT" and field_info.id == "FT":
        if not value:
            return "."
        elif isinstance(value, list):
            return ";".join(map(format_atomic, value))
    elif field_info.number == 1:
        if value is None:
            return "."
        else:
            return format_atomic(value)
    else:
        if not value:
            return "."
        else:
            return ",".join(map(format_atomic, value))
1265789
def find_header(header)
      {}.tap do |returning|
        contents.scan(header_with_content_regexp(header)).flatten.first.split("\n").each do |setting|
          name, value = *setting.split('=').map(&:strip)
          returning[name] = value
        end
      end
    end
495773
def html(header_rows):
    
    name = 'table%d' % next(tablecounter)
    return HtmlTable([map(str, row) for row in header_rows], name).render()