Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

how can i give a condition so that my widget will be visible to only particular maintain item

Anil Jha
Kilo Contributor

how can i give a condition so that my widget will be visible to only particular maintain item 

10 REPLIES 10

Mark Guldhammer
Giga Guru

Hi

You could do something like this

 

HTML side:

<h1 ng-if="showWidget()">
  Hello World!
</h1>

 

Client Controller side:

$scope.showWidget = function() {
 //return true to show, false to hide
 return myMaintainItemId = '1234';
};

in maintain itemid i have to give sysID of that maintain item ?

Yes, you would need some additional code to find out which item you are currently viewing, and then you can do the check.

 

var currentItemId; //add code to find currently viewing item sys_id
var showItemId = '1234' // sys_id of the item where you want to display the widget

$scope.showWidget = function() {
 return currentItemId = showItemId;
};

 

Then the widget will only be displayed, when viewing that one specific item.

This is HTML code could you please help me where to declare ng-if 

Html :

<div class="panel panel-default b" ng-init="c.trackPage()">
<div class="panel-heading" >
<h2 class="panel-title">{{::data.messages.myRequestsTitle}}</h2>
</div>
<div class="panels-container list-group" >
<div class="list-group-item row" style="margin:0px;border-top:0px;" >
<div class="col-md-5" style="">
<div class="input-group">
</div>
</div>

</div>
</div>
<div ng-if="c.data.request.req_list.length == 0 && !c.filterText" class="panel-body panels-container">
${You do not have any requests}
</div>
<div ng-if="c.data.request.req_list.length == 0 && c.filterText" class="panel-body panels-container">
${Search didn't match any requests}
</div>
<div role="table" class="table table-responsive m-b-none">
<div role="rowgroup" class="sr-only">
<div role="row">
<span role="columnheader">${Request}</span>
<span role="columnheader">${State}</span>

</div>
</div>
<div role="row" class="list-group-item table-responsive" ng-repeat="item in c.data.request.req_list | limitTo: c.data.lastLimit track by item.sys_id" style="margin:0px" >
<div role="cell" class="col-xs-6 padder-l-none padder-r-none main-column">
<div class="primary-display">
<a href="?id={{::item.url.id}}&table={{::item.url.table}}&sys_id={{::item.url.sys_id}}" sn-focus="{{::item.highlight}}"> {{::item.display_field}} </a>

</div>
<small class="text-muted">
<div ng-repeat="f in item.secondary_displays" class="secondary-display">

<span >{{::f.display_value}}</span>
</div>
</small>
</div>
<div role="cell" class="col-xs-3 padder-l-none padder-r-none state-column">
<div class="state">
<span> {{::item.state}}</span>
</div>
</div>

</div>
</div>
</div>
</div>