Show or hide Widget by condition

Brook3
Giga Expert

----------------

widget always hide

IF "state" field of "sn_hr_core_case" table is "7" THEN widget show

----------------

How can I write this condition (Script) in my widget?

Thank you so much!

3 REPLIES 3

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

In Server script you need to check the state of the ticket and set the flag as below

data.flag = true; //if state is 7

else

data.flag =false;

 


Then in HTML you just need to use

 <h2 ng-if="data.flag" >

//May be you are calling widget here.

</h2>

 

Thanks,
Ashutosh

Pratiksha Kalam
Kilo Sage

Hello,

Check below script,

 
 
 
<div class="button">

  <button id = "MyButton" ng-click="c.start()" >  
   <span ng-show="!c.flag">Click me</span>
    <span ng-show="c.flag">Hide me</span>
  </button>
  <h1>{{c.data.name}}</h1>
</div>

<div class = "list" ng-show="c.flag">
  <table id="t01" >
    <tr>
      <th>STATE</th>
      <th>DESCRIPTION</th>
    </tr>
</div>
 
In client controller,
 
function() {
/* widget controller */

var c = this;
c.data.u_business = 1;
c.flag = false;

c.start = function()
{
c.data.name="Hi";
c.flag=true;
}

}
 
If answer is helpful please mark it correct!

Thanks,
Pratiksha

Bhagyashri Sort
Kilo Guru

Hi,

Along with the script suggested by Pratiksha refer below link too.

Show/Hide a Button Widget based on "State" field on Form Widget

 

Mark it correct and helpful, if you find it useful to you.

Thanks

Bhagyashri Sorte.