Download raw data in Joomla component -


i have written joomla component working well. want add button admin list view when clicked automatically starts csv download of items selected in list.

i'm ok model logic, problem i've got passing selected cids or presenting raw output without template.

if use jtoolbar's appendbutton function add 'link' type button, can send user url 'format=raw', can't send information items checked.

if use jtoolbarhelper::custom add custom list button, can send information buttons checked, can't send format=raw

as far can see there 2 solutions, don't know how implement either of them. option 1 force templateless raw output without url parameter of format=raw. option 2 set hidden variable format=raw in admin form.

any appreciated

i've solved follows:

i added hidden field admin form

<input type="hidden" name="format" value="html" /> 

then subclassed jtoolbarbuttonstandard overriding _getcommand with

protected function _getcommand($name,$task,$list) {     jhtml::_('behavior.framework');     $message = jtext::_('jlib_html_please_make_a_selection_from_the_list');     $message = addslashes($message);      if ($list)     {         $cmd = "if (document.adminform.boxchecked.value==0){alert('$message');}else{document.getelementbyid('adminform').format.value='raw'; joomla.submitbutton('$task')}";     }     else     {         $cmd = "document.getelementbyid('adminform').format.value='raw'; joomla.submitbutton('$task')";     }      return $cmd; } 

so when button clicked changed format parameter html raw.

i'm not going mark solved in case has better ideas


Comments