Add field to sortable and its heading not displayed

wallyhowe 28 Jan, 2015
Hi
I was having problems with the blank page when using Table listings (custom ones all fine) and followed instructions from another post, re-installed CC5 so all works well.

However, whenever I make a column sortable the title of that column disappears. When I hover over the title space there is a placeholder there and when clicked the table does sort.
I created a copy of your tutorial on Joomla articles to see if it was my listing but the same thing happens.

To keep it to a minimum, In columns list i have:

Article.id:ID
Article.title:Title

In sortables I have:

Article.title

Wallyhowe
GreyHead 28 Jan, 2015
Hi Wallyhowe,

My best guess is that the CSS being applied to the sortable header makes the text the same color as the background. I suggest that you check with your browser web developer tools.

Bob
wallyhowe 28 Jan, 2015
Hi Bob

That is it.

The background is white and the text is white when sortable.

Many thanks.

I have another problem with headings. I am following your 'How to' document on 'Dynamic filters for your listing 2' and applying it to a listing of my own. I have one filter box implemented from your first document.

I added the following code into the header to add a drop down list. The filters work. but the sortable headers disappeared and there is no place holder where the header should be:

Also, when initially displayed, the filter box for the drop down list gets displayed with the first entry showing rather than the drop down being blank.

Definately worth a beer if you can see what I am doing wrong.

Wallyhowe

Code:
<div class="allocation">

<?php
$script = "";
$script .= "
$('clear').addEvent('click', function() {
$('title').value = '';
$('filter_text').value = '';
$('filter_catid').selectedIndex = -1;

});
";
if ( $script ) {
$doc =& JFactory::getDocument();
$script = "window.addEvent('domready', function() { $script });";
$doc->addScriptDeclaration($script);
}
?>

<?php
$title = JRequest::getString('title', '', 'post');
?>
<?php
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query = "
SELECT `dest_id`, `destination`
FROM `#__chronoforms_data_destination_table` WHERE dest_estate = \"$estate\" ;
";
$db->setQuery($query);
$data = $db->loadObjectList();
?>
<select name='filter_catid' id='filter_catid' >
<?php
$filter_catid =& JRequest::getInt('filter_catid', '', 'post');
foreach ( $data as $d ) {
$selected = '';
if ( $d->dest_id == $filter_catid ) {
$selected = "selected='selected'";
}
echo "<option value='".$d->dest_id."' $selected >".$d->destination."</option>";
}
?>
</select>

<input type='text' name='title' id='title' value='<?php echo $title; ?>' /> <input type='submit'
name='filter' id='filter' value='Filter' /> <input type='button' name='clear' id='clear' value='Clear' />

</div>
wallyhowe 29 Jan, 2015
I forgot to say that this is CC4 not 5. (I was trying CC5 to see if it allowed a better way of doing it).

On removing this code from the header and sortable headings work.

The single filter works. The code for that is:

<div class="allocation">

<?php
$script = "";
$script .= "
$('clear').addEvent('click', function() {
$('title').value = '';
});
";
if ( $script ) {
$doc =& JFactory::getDocument();
$script = "window.addEvent('domready', function() { $script });";
$doc->addScriptDeclaration($script);
}
?>

<?php
$title = JRequest::getString('title', '', 'post');
?>

<input type='text' name='title' id='title' value='<?php echo $title; ?>' /> <input type='submit'
name='filter' id='filter' value='Filter' /> <input type='button' name='clear' id='clear' value='Clear' />

</div>
wallyhowe 29 Jan, 2015
The problem is the line:

$data = $db->loadObjectList();

The name $data is obviously used with the CC4 code as well.

I renamed it and the headings reappeared.

now need to work out why the initial entry for the drop down is not blank but the first entry.

Wallyhowe
wallyhowe 29 Jan, 2015
Answer
1 Likes
Solved it by adding a line before the loop that populated the drop down:

echo "<option value='-1' >All destinations</option>";

and amending the SQL WHERE to test for $filter_catid >0

Can close this now.

Wallyhowe
This topic is locked and no more replies can be posted.