Workflow and ServiceDesk Community

 View Only

Grid component customization, colours, images etc., Workflow 8.0+ 

Feb 10, 2017 09:48 AM

Hello all - I received a request a few months ago asking about options for customizing the new (8.0+) Kendo grid components.  Here was the original request (paraphrased):

I am not sure how much we can do for them as the things they raised simply do not work (and do not seem to have analogues for) in WF 8.0 Grid.  I am wondering if you have encountered this and have any ideas.

From customer’s response and screenshots, these are the three things they were using and 8.0 does not do:

1.    A way to have images in the Grid. In 7.1 this is done by having HTML in the data.
2.    Color scheme for Grid. Will clarify what he uses but I suspect Styles which are no longer there in 8.0.

Here's the workaround i found that works with the new Grid components, to color and style, as well as include images in the grid.


Using an Include HTML component for the CSS for the grid (where the grid has a control ID of TestTable):

<style>
td {
  font-family: 'Segoe UI', Helvetica, Arial;
}
#TestTable table {
  width: 100% !important;
  border-collapse: collapse;
}
#TestTable th {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  background-color: #6e1515;
  text-align: center;
  width: 1px;
  white-space: nowrap;
}
#TestTable td {
  background-color: #dbcaca;
  border: solid 1px #ffffff;
  white-space: normal !important;
}
</style>

This CSS code can be set in a Merge Text component ahead of the form it's used on.  See this article for more information on including HTML/CSS on workflow web forms.

And using the following javascript, which is pretty lightweight and easy to drop into any appropriate forms:

OnLoad (Body Custom Events for your form):

replaceEncodes();
replaceJunkText();
document.documentElement.style.visibility = 'visible';

Form Script (Script section in the Behavior tab for your form):

document.documentElement.style.visibility = 'hidden';
function replaceEncodes() {
var testTable = document.getElementById('TestTable');
testTable.innerHTML = testTable.innerHTML.replace(/&lt;/g, '<');
testTable.innerHTML = testTable.innerHTML.replace(/&gt;/g, '>');
}
function replaceJunkText() {
var testTable = document.getElementById('TestTable');
testTable.innerHTML = testTable.innerHTML.replace(/&lt;="" td=""&gt;/g, '');
}

Double-click in any white (empty) space on your open form editor in Workflow and you should get to the "Behavior" tab.  This is where you'll find the Body Custom Events (where you add the onload) as well as the Script section (at the bottom, where you include any functions you intend to call).


2017-02-10_08-40-48.jpg

Test_Grid_Image.png


 

I've attached a sample project as well.

feel free to reach out to me with any questions.  thanks!

Statistics
0 Favorited
0 Views
1 Files
0 Shares
0 Downloads
Attachment(s)
package file
Test_Grid.package   387 KB   1 version
Uploaded - Mar 11, 2020

Tags and Keywords

Comments

Jun 24, 2019 06:09 AM

Thank you andrew, this works.

Jun 18, 2019 11:18 AM

Hi @woswasi - you can try swapping the javascript here:

document.documentElement.style.visibility = 'hidden';

function replaceEncodes() {
var testTable = document.getElementById('TestTable');
testTable.innerHTML = testTable.innerHTML.replace(/&lt;/g, '<');
testTable.innerHTML = testTable.innerHTML.replace(/&gt;/g, '>');
}

function replaceJunkText() {
var testTable = document.getElementById('TestTable');
testTable.innerHTML = testTable.innerHTML.replace(/&lt;="" td=""&gt;/g, '');
testTable.innerHTML = testTable.innerHTML.replace(/&lt;=""&gt;/g, ''); // <--- New code
}

 

Note that i don't have access to an installation of 8.1.6, so i am unable to reproduce. this is just a guess.

Jun 18, 2019 11:01 AM

This must be a versioning issue - i'm on 8.5 and this does not occur.

Jun 17, 2019 03:13 AM

iam using 8.1.6231.0

Jun 13, 2019 10:03 AM

hi there - what version of workflow are you using?

Jun 13, 2019 02:48 AM

Dear africo, can you help me. i tested your project above, but i get always symbols behind the beach image. do you have a idea what i do wrong? Thanks martin

 

Related Entries and Links

No Related Resource entered.