I want to add headers to this table. But it does not work. I'm sure I'm doing something wrong. :)

function my_module_rates_page(provider) {
  try {
    var header = [];
    header.push({ data: 'Country' });
    header.push({ data: 'Landline' });
    header.push({ data: 'Mobile' });
    header.push({ data: 'SMS' });
    var content = {};
    content['my_rates_list'] = {
      theme: 'view',
      header: header,
      format: 'table',
      pager_pos: 'bottom',
      format_attributes: {
        border: 0,
      },
      path: 'mobile/rate/'+provider, /* the path to the view in Drupal */
      row_callback: 'my_module_rates_list_row',
      empty_callback: 'my_module_rates_list_empty',
      attributes: {
        id: 'my_rates_list_view'+provider
      }
    };
    return content;
  }
  catch (error) { console.log('my_module_rates_page - ' + error); }
}

Comments

tyler.frankenstein’s picture

Title: Table header » Table headers in a View
Category: Support request » Feature request
Status: Active » Needs work

Table headers are only supported when making a table render array, I don't think they work when using a view render array as a table. The improvements will have to happen somewhere around here: https://github.com/signalpoint/DrupalGap/blob/7.x-1.x/src/modules/views/...

coolman7’s picture

I implemented with manually created tables as explained here:
http://drupalgap.org/node/237

It worked but all cells and headers aligned left. I don't figure out how to align text in cells and headers right or center?

Thanks

tyler.frankenstein’s picture

You'll have to use CSS for now as the table system isn't flexible enough. Or you can contribute to the table system and make this flexibility a reality ;)

coolman7’s picture

Ok. I decided to contribute and make some changes in core with fork of github repository. I have some problems while forking and compiling. I've just opened an issue at github.
Thanks