[Piwik-hackers] managing column names in Controller

Sergey Stoyan stoyan at cliversoft.com
Wed Jul 23 14:47:10 CEST 2008


Hi Matt,

On 7/23/08, Matthieu Aubry <matthieu.aubry at gmail.com> wrote:
> Would you just want to rename "Label" into a more specific string that
> would define your column content?
>

I just thought that some archives can be used by different widgets and
so column names might depend on the context where they are used.

Please look at the following.
My plugin's API does not return dataTable from archive but constructs
it like the following tested sample:

API::function getEntryPageActivity(…)
{
$dataTable = new Piwik_DataTable;
for($i = 0;$i < 5; $i++)
{
$dataTableRow = new Piwik_DataTable_Row;
$dataTableRow->setColumns(array('page'=>"$i",  'label'=>"$i",
'entry'=>"name".(10 - $i)));
       $dataTable->addRow($dataTableRow);
}
return $dataTable;
}

I'm not sure it is a reason of the following issues though:

1)
Call $view->setColumnsToDisplay('label', 'entry') in Controller does
not suppresses
the column that goes first in dataTable; that's it is displayed even if
it is not listed in setColumnsToDisplay. In the sample it is 'page'
that is always seen in the widget.

2)
If column 'label' is absent in dataTable returned by API then it is added
automatically to the widget by Control as an empty column. Thus I had
to add label as a second column to have it absent in the widget.

3)
Sorting works only for the first column. The rest columns looks like
sortable and gets some unpredictable order by the first click on them,
after it no reorder occurs. I understand this issue appears due to the
dataTable is generated within API function but what is wrong there?

Regards,
Sergey



> Sergey Stoyan wrote:
> > Hi there,
> >
> > I found the following:
> > Call $view->setColumnsToDisplay(…) in Controller does not suppresses
> > the column that goes first in dataTable, that's it is displayed even
> > it is not listed in setColumnsToDisplay.
> >
> > Also, if column 'label' is absent in dataTable then it is added
> > automatically in the widget as an empty column.
> >
> > Is it possible to change column names in Controller? Sometimes we do
> > not want to see Label name in widget but something more definite.
> >
> > Thanks,
> > Sergey
> > _______________________________________________
> > Piwik-hackers mailing list
> > Piwik-hackers at piwik.org
> > http://lists.piwik.org/cgi-bin/mailman/listinfo/piwik-hackers
> >
> >
> _______________________________________________
> Piwik-hackers mailing list
> Piwik-hackers at piwik.org
> http://lists.piwik.org/cgi-bin/mailman/listinfo/piwik-hackers
>


-- 
www.cliversoft.com


More information about the Piwik-hackers mailing list