Scripting for specific cell in a table

Avatar

Avatar
Level 1
abhijeetk882181
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

0 solutions
View profile

Avatar
Level 1
abhijeetk882181
Level 1

Likes

0 likes

Total Posts

1 post

Correct reply

0 solutions
View profile
abhijeetk882181
Level 1

28-12-2018

Hi All,

   I am displaying a table which contains subtotals and grand-total and this table is coming as an XML file from a Java program directly.

The exact cells in a row which contains subtotal text and grand total text have to be enclosed with a border as shown below:-

1655625_pastedImage_1.png

I was able to achieve it using this code

if (this.rawValue == "Sub-Total:" || this.rawValue == "Grand Total:") {

   this.font.weight = "bold";

   this.border.getElement("edge",0).presence = "visible";

   this.border.getElement("edge",1).presence = "invisible";

   this.border.getElement("edge",2).presence = "visible";

   this.border.getElement("edge",3).presence = "invisible";

}

The issue is the subsequent cell which contains the subtotal and grand total value also has to be enclosed with a border similarly. But I am not able to achieve this functionality. Kindly suggest a solution.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

28-12-2018

You can set the borders of the surrounding row instead of the cells.

var oThis = this,

    oParent = oThis.parent;

if (oThis.rawValue.match(/^(Sub-Total:|Grand Total:)$/g)) {

  oThis.font.weight = "bold";

  oParent.border.getElement("edge",0).presence = "visible";

  oParent.border.getElement("edge",1).presence = "invisible";

  oParent.border.getElement("edge",2).presence = "visible";

  oParent.border.getElement("edge",3).presence = "invisible";

}

If you only want set the borders of specific cells on each row you can do this the following way:

var oThis = this,

    oParent = oThis.parent;

if (oThis.rawValue.match(/^(Sub-Total:|Grand Total:)$/g)) {

   oThis.font.weight = "bold";

   // Modify cell named "Cell1"

   oParent.Cell1.border.getElement("edge",0).presence = "visible";

   oParent.Cell1.border.getElement("edge",1).presence = "invisible";

   oParent.Cell1.border.getElement("edge",2).presence = "visible";

   oParent.Cell1.border.getElement("edge",3).presence = "invisible";

   // Modify cell named "Cell3"

   oParent.Cell3.border.getElement("edge",0).presence = "visible";

   oParent.Cell3.border.getElement("edge",1).presence = "invisible";

   oParent.Cell3.border.getElement("edge",2).presence = "visible";

   oParent.Cell3.border.getElement("edge",3).presence = "invisible";

}

Answers (0)