Jump to content
Sign in to follow this  
KPRJD

Colour coding based on Priority

Recommended Posts

Hello all,

I'm trying to modify our request list to colour each request based on priority. I've narrowed it down to be either in list_cr.htmpl and/or list_edit.js.

I've tried inserting a PDM_IF tag somewhere around line 337 on list_cr.htmpl. Problem is, I'm only stabbing in the dark whether I'm actually using proper syntax or even hitting a variable that exists. I tested with something like this:

<PDM_IF "$args.priority" >= "4">

do stuff here

</PDM_IF>

Does nothing other than blanks the request list. I've been trying to pick apart the docs but I'm not getting something. Is there anyone that can point me in the right direction?

Thanks!

Share this post


Link to post
Share on other sites

hi

you need to add fmtfunc to your priority lscol and add additional lswrite to fetch priority enum.

there would be something like this:

<PDM_MACRO name=lscol attr=priority fmtfunc=zPriClr>
<PDM_MACRO name=lswrite text="var zPriEnum = @{list.priority.enum:0}">

function zPriClr(val) {
	function zGetPriClr(enumVal) {
		switch (enumVal) {
			case 1:
				return "red";
			case 2:
				return "blue";
			case 3:
				return "green";
			default:
				return "black";
		}
	}
	rs.data("<span style='color:" + zGetPriClr(zPriEnum) + "'>" + val + "</span>");
}

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...