• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

NAB grid widget set an icon in the grid?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NAB grid widget set an icon in the grid?


    I'd like to use the render function in the grid widget to show an icon instead of plan text, making it more appealing to a user.

    could'nt find anything similar in the examples nor in previous items on the forum/.

    i suppose it should look like someting here


    PHP Code:
    function (v,recfilters)  if (== 'ACTION')  {      return '<img src="images/action.png" />';   } else {      return <img src="images/something else.png" />';   } 
    don't know if this is the right way??

    if yes, where (on which folder) on the ifs should i save those icons? and are there some best practices about the size and type to be used that works in combination with the grid-widget?

    thx in advance

  • #2
    In NAB, have a look at the configuration behind the Order Entry example app (you can get to it by clicking on the cog wheel at the top of the data source/widget list and checking the "Show Examples" box).

    The "Order Line List" edit grid widget for this app has a an IMAGE column. This column's custom renderer links to a "/resources" alias, set up in the Apache config, to access images in the /valence-5.2/resources folder and display them in the cell. If you want to store your images in some other folder then you'll need to set up an appropriate alias in your Apache config so the browser can stream documents from it without encountering any authority issues.

    As for best practices, you'll just want to be sure the images you're linking to are web-ready and as small as possible. Otherwise it can significantly slow down the rendering.


    FYI, in the next build, which should be released next week, we'll be introducing icon columns to NAB grids, which are configured in Behaviors. These icons act as buttons for each row, with special actions behind them. So a little more intuitive than the current row menu button option.

    Comment

    Working...
    X