This topic is locked

Hide buttons on list page after first record in that group

4/24/2025 2:28:54 PM
PHPRunner General questions
A
asawyer13 authorDevClub member

I have 3 buttons on my list page. In each row.

the order of data is container number, then part number.

I want the 3 buttons to only appear on the first row for each container.

I have been trying all kinds of things, but can't figure it out.

Any help would be appreciated.

Thanks
Alan

C
copper21 4/25/2025

Will need more info to help...how about a screenshot of the list page with buttons?

D
DealerModulesDevClub member 4/25/2025

Maybe you can slice the array like:

// Get top 1 record
$topRecords = array_slice($records, 0, 1);

foreach ($topRecords as $record) {
echo "<div>";
echo "{$record['name']}";
echo " <button>Edit</button> <button>Delete</button>";
echo "</div>";
}

// Show the rest without buttons
$restRecords = array_slice($records, 1);

foreach ($restRecords as $record) {
echo "<div>";
echo "{$record['name']}";
// No buttons
echo "</div>";
}

You will need to substitute the "Delete button" for your buttons.

Paul