News:

Wondering if this will always be free?  See why free is better.

Main Menu

Subs-List concern

Started by Diego Andrés, August 02, 2018, 01:02:50 PM

Previous topic - Next topic

Diego Andrés

So I'm working with this lovely file to make my life easier but I ran into something while using the additional_rows array.
So in theory this one works just as the regular values I'm using in the list columns, right?
E.g I can put a custom function

'additional_rows' => array(
'test' => array(
'position' => 'above_column_headers',
'function' => function($row){ echo 'test';}
),
),


However this generates an error in the log stating that value is empty. So I came up with this
'additional_rows' => array(
'test' => array(
'position' => 'above_column_headers',
'function' => function($row){ echo 'test';},
'value' => ''
),
),


and it solves this issue.


HOWEVER if I try to use a function in some other file in some other custom list it just won't show up.

Any particular reasons why it wouldn't consistently work in both using a custom function? It only lets me add data through the value option.

Thanks


Edit: This is on SMF 2.1 btw, I'm not sure if it happens on 2.0.x branch as well

SMF Tricks - Free & Premium Responsive Themes for SMF.

Arantor

How are you trying to use a function in some other file exactly?

Diego Andrés

Well, the list allows you to use custom functions so I can for example use a format function for the value.
But in this example I added a select option above the table so I can filter categories in my list items.  Like I said, it works in one list, but not in a second one in a different file.

It's not a big deal, I can use template layers but just wondering what could cause the second list to not display that additional row with a function.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Arantor

Well, it *is* used this way in 2.1 - check out AdminApprove() in ManageMembers.php where this very thing is done to prove a dropdown to provide a selection.

Diego Andrés


SMF Tricks - Free & Premium Responsive Themes for SMF.

Diego Andrés

That was useful, I thought about doing something similar but never as a real option, maybe I didn't picture it correctly in my head.
Thanks for the tip.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Advertisement: