GlideModal height is not working (bug), alternatively change the List View paging??

Rahman4
Tera Guru

i Guys,

I have this simple client UI Action that pops up a GlideModel and populates with major incidents. The problem that I have is eventhough I have set the height but when the dialog pops up it pushs the dialogue based on number of records and total pages which is 20 by default. I have created a custom list view called "dialog_view" that has only limited fields. What I ideally want that the height works correctly and it shows scrollbar if rows exceed. Alternatively, I would like to set the page size in my custom list view to let is say 5 or 10 so I can control the height e.g. for this custom view or through script. Or any other options please?

UI action Code (You should be able to copy and paste and it should work):

function showModal() {

//Initialize the GlideDialog window
var w = new GlideModal('dialog_view', false, 600);
w.setTitle('Major Incidents');
w.setPreference('table', 'incident_list');
w.setPreference('sysparm_view', 'dialog_view');
//Set the query for the list
var num = g_form.getValue('number');
var query = 'active=true^priority=1^number!=' + num;
w.setPreference('sysparm_query', query);
w.setSize(600,600); // Height Not working
//Open the popup
w.render();

}

 

This is how it looks (Total crap!!):

find_real_file.png

 

This is how I want it:

 

find_real_file.png

 

find_real_file.png TIA

 

 

1 ACCEPTED SOLUTION

Rahman4
Tera Guru

Hi,

Ok, for anyone else who might be having this problem in the future, I managed to handle it this way by limiting the number of rows to 10. The following is the code that works:

The trick was to set this: w.setPreference('sysparm_force_row_count', '10'); // To enable row limit

 

function showModal() {

    //Initialize the GlideDialog window
    var w = new GlideModal('dialog_view');
    w.setTitle('Major Incidents');
    w.setPreference('table', 'incident_list');
    w.setPreference('sysparm_view', 'dialog_view');
	w.setPreference('sysparm_force_row_count', '10'); // To enable row limit???
    //Set the query for the list
    var num = g_form.getValue('number');
    var query = 'active=true^priority=1^number!=' + num;
    w.setPreference('sysparm_query', query);
    w.setSize(800, 600);
    //w.adjustBodySize();
    //Open the popup
    w.render();


}

View solution in original post

7 REPLIES 7

Mike Patel
Tera Sage

Can you try below

function showModal() {

    //Initialize the GlideDialog window
    var w = new GlideModal('dialog_view');
    w.setTitle('Major Incidents');
    w.setPreference('table', 'incident_list');
    w.setPreference('sysparm_view', 'dialog_view');
    //Set the query for the list
    var num = g_form.getValue('number');
    var query = 'active=true^priority=1^number!=' + num;
    w.setPreference('sysparm_query', query);
    w.setSize(600, 600);
    w.adjustBodySize();
    //Open the popup
    w.render();

}

Hi,

Is this code working in your local instance? What is adjustBodySize? I get error "adjustBodySize is not a function" and the modal doesn't show even?

 

ta

I just wanted to try and see if it works on GlideModal since it works fine on GlideDialogWindow. 

Based on Doc looks like you can't set height

https://developer.servicenow.com/dev.do#!/reference/api/orlando/client/c_GlideModalClientSideV3API

Hi,

I am happy to change GlideModal to GlideDialogWindow if it works. adjustBodySize is not working on GlideDialogWindow either.

Do you have an example that it works for you?