List view in UI page

malu
Tera Contributor

Is it possible to bring up the list view in UI page.

eg: we have a baseline module , after creating a new baseline we can see the list of entries for a specific condition as shown below is it possisble to bring up these list (CMDB Baseline Entries) into an UI page ?

find_real_file.png

1 ACCEPTED SOLUTION

Hi Malu,



You need change the code of iframe like below code getting Incident list based on Caller




<g:ui_reference name="requester_id" query="active=true" table="sys_user" id="requester_id" value="${gs.getUserID()}" displayvalue="${gs.getUser().getName()}"/>
<button class="button" style="margin-left:5px" id="getList" onclick="getIncList();">Get User Incidents</button>


<div id="targetList">      
<iframe src="incident_list.do?sysparm_query=caller_id=javascript:gs.getUserID()" style="min-height:400px;width:100%;" scrolling="no" frameborder="0"></iframe>
</div>

<script>
        function getIncList(){
                  var caller = document.getElementById('requester_id').value ;
                  var newIframe = '<iframe src="incident_list.do?sysparm_query=caller_id='+caller+'" style="min-height:400px;width:100%;" scrolling="no" frameborder="0"></iframe>' ;
                  document.getElementById('targetList').innerHTML =newIframe ;
        }
</script>


View solution in original post

22 REPLIES 22

malu
Tera Contributor

Hi Gurpeet, I'm confused with the line "provide the link of the list to the list", so do i need to create a list in the UI page and then link the list of CMDB Baseline entries list to it?


Hi Malu,



You need change the code of iframe like below code getting Incident list based on Caller




<g:ui_reference name="requester_id" query="active=true" table="sys_user" id="requester_id" value="${gs.getUserID()}" displayvalue="${gs.getUser().getName()}"/>
<button class="button" style="margin-left:5px" id="getList" onclick="getIncList();">Get User Incidents</button>


<div id="targetList">      
<iframe src="incident_list.do?sysparm_query=caller_id=javascript:gs.getUserID()" style="min-height:400px;width:100%;" scrolling="no" frameborder="0"></iframe>
</div>

<script>
        function getIncList(){
                  var caller = document.getElementById('requester_id').value ;
                  var newIframe = '<iframe src="incident_list.do?sysparm_query=caller_id='+caller+'" style="min-height:400px;width:100%;" scrolling="no" frameborder="0"></iframe>' ;
                  document.getElementById('targetList').innerHTML =newIframe ;
        }
</script>


malu
Tera Contributor

Thanks Gurpreet..Awesome one I will try with this



Just a minor and silly question , I have the reference field like below


<g:ui_reference name="name" query="active=true" table="cmdb_baseline" id="baseline_name" value="${           }"/>



Now from UI page I have selected the name from reference list (cmdb_baseline), now i want to pull the selected value into iframe javascript instead of gs.getUserID fromt the above value="${           }"/> what will be syntax and how can i set it up?



<iframe src="cmdb_baseline_entry_list.do?sysparm_query=caller_id=javascript:gs.getUserID()" style="min-height:400px;width:100%;" scrolling="no" frameborder="0"></iframe>


Hi Ravi,



Please try like below.


caller_id=${variableName}



if above is not working then you may need to get same value in javascript variable.


malu
Tera Contributor

Thanks Gurpeet. I tried with this BUT list bring all values from baseline entry table:(



<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


<g:ui_reference name="baseline_name" query="active=true" table="cmdb_baseline" id="baseline_name" value="${baseline_name}" displayvalue="${baseline_dis_name}"/>


<button class="button" style="margin-left:5px" id="getList" onclick="getBaseEntList();">Get Baseline Entries</button>


<div id="targetList">      


<iframe src="cmdb_baseline_entry_list.do?sysparm_query=baseline=${baseline_dis_name}" style="min-height:400px;width:100%;" scrolling="no" frameborder="0"></iframe>


</div>



<script>


        function getBaseEntList(){


                  var caller = document.getElementById('baseline_name').value ;


                  var newIframe = '<iframe src="cmdb_baseline_entry_list.do?sysparm_query=baseline_name='+caller+'" style="min-height:400px;width:100%;" scrolling="no" frameborder="0"></iframe>' ;


                  document.getElementById('targetList').innerHTML =newIframe ;


        }


</script>


</j:jelly>