Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9256555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:58:17+00:00 2026-06-18T11:58:17+00:00

Just started using ATK4 and appreciating it very much so far, but not sure

  • 0

Just started using ATK4 and appreciating it very much so far, but not sure how to do this…

What I am trying to accomplish:

I am outputting a query’s results to a grid, one of the fields is ‘status’, the data will either be ‘-1’ or ‘1’.
Instead of outputting -1 or 1 to the column, how do I output an HTML snippet (or whatever I need to to get what I want) instead that shows a different icon for each value?
In short:

In column ‘status’:

  • if the value is -1, display iconDown.gif;
  • if the value is 1, display iconUp.gif

Code so far:

class page_showlist extends Page {
function init(){
    parent::init();

    $q=$this->api->db->dsql();
    $q->table('remote_system')
            ->join('customers.id','customer_id')
            ->field('customer_id')
            ->field('ip')
            ->field('nickname')
            ->field('name','customers')
            ->field('status')
    ;

    $grid = $this->add('Grid');

    $grid->addColumn('text','status')->makeSortable();
    $grid->addColumn('text','name')->makeSortable();
    $grid->addColumn('text','ip');
    $grid->addColumn('text','nickname');
    $grid->addButton('Reload Grid')->js('click',$grid->js()->reload());
    $grid->addQuickSearch(array('name'));
    $grid->setSource( $q );
    }

}

Any pointers/tips?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:58:19+00:00Added an answer on June 18, 2026 at 11:58 am

    To add column with icons in Grid you can use custom template.

    In one of my projects I do like this:

    $url = $this->api->pm->base_url . $this->api->locateURL('template', 'images/');
    $grid->addColumn('template', 'type', false)
        ->setTemplate('<img src="' . $url . 'icon_object_<?$type?>.png">');
    

    It’ll use model field named type (in your case use status) and show icons in that column. Icon source URL is generated dynamically and it’ll search for image files in your template/images directory named icon_object_XXX.png where XXX value will be taken from field type value.

    In my case type is like this: array('building','apartment','land','garage') etc.

    And one more thing – you should start using Models whenever possible! That way you’ll ease your life later when your project becomes bigger. Also can have extra security (conditions, etc.) with them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started using GIT yesterday and i was trying to do something but
I just started using events and delegates in C# and I'm not sure if
I just started using MagicalRecord, and this might be a stupid question, but it's
I just started using Eclipse but already I have a small problem. At first
Just started using VBA and I'm trying to access all the data in a
I just started using the documentclass in flash... but i am already hitting problems..
I just started using Kendo UI and did this tutorial to learn the basics,
I just started using LISP, coming from a background in C. So far its
I just started using FPC to practice more my old knowledge of Pascal, but
Just started using log4net and trying to get my head around the config and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.