Is there a way I can add scroll bar in glide window popup

now_dev
Mega Expert

Hi All,

I am creating glide window pop up in UI action. This popup will display on click of list button. I have a requirement where records should be groupby 'name' field.

But when I use group by, it return all the records in the list instead 5-10 records.

My requirement is to display only 10 records in a popup groupby name and I have tried using "sysparm_force_row_count" but it's not working. However if I remove groupby "sysparm_force_row_count" work perfectly. Since groupby is a part of requirement and I can't remove it, I thought of adding scroll within popup. Any suggestion would be appreciated.

function slots(){

  var gdw = new GlideDialogWindow('show_list');

  gdw.setTitle('Available Slots');

  gdw.setPreference('table','u_test_table_list');

  gdw.setPreference('title', 'Available Slots');

  gdw.setPreference('sysparm_view','default');

  gdw.setPreference('sysparm_force_row_count','10');

  var query = "GROUPBYu_name";

  gdw.setPreference('sysparm_query', query);

  gdw.render();

}

8 REPLIES 8

Slava Savitsky
Giga Sage

In grouped lists sysparm_force_row_count parameter works differently. Namely it defines the maximum number of records displayed in each group. I think this behavior has changed in List v3 though.



GlideDialogWindow does not seem to have scrolling capability. You might, however, be able to achieve this with GlideModal instead. Try this piece of code:



function slots(){


      var gdw = new GlideModal('show_list');


      gdw.setTitle('Available Slots');


      gdw.setSize(400); // small-sized window with a scrollbar


      gdw.setPreference('table', 'u_test_table_list');


      gdw.setPreference('sysparm_view', 'default');


      gdw.setPreference('sysparm_force_row_count', '10'); // number of records in a group


      gdw.setPreference('sysparm_query', "GROUPBYu_name");


      gdw.render();


}



As far as I understand, the scrollbar is only a workaround. If you could share some more information about the business requirement, we might be able to find a better way. Do you need to display the first 10 groups or the top 10 records? Note that groups are always sorted alphabetically and cannot be rearranged. What if the first group contains 20 records? Would you like to see just that one group with the first 10 records from it?


now_dev
Mega Expert

Hi Slava,



My requirement is pretty simple. I wanted display list of records in popup where records are groupby date and order by start time.


I just wanted to display first 10 group in popup. I don't wanted to limit records in the group rather i wanted to limit overall grouped record.



Below screenshot will give you fair idea about my requirement. As you can see pop up is displaying list of grouped records which is increasing the length of popup and user has to scroll all the way down to find the button given on the pop up for further actions.



As per below screenshot I just wanted to display Records from Date: 27-Dec-2016 till Date: 23-Feb-2017, irrespective of number records under each group.



find_real_file.png



find_real_file.png


Hi Slava,



I tried using GlideModel and it resolved the problem to some extent. Can't we give height in glidemodal, it seems to only accept width.



find_real_file.png


You are right, it only accepts width. Moreover, it has only four possible sizes: alert, small, medium (default) and large. Here is what setSize method of the GlideModal actually looks like:



function(width) {


      this.size = 'modal-md';


      if (!width)


              this.size = 'modal-md';


      else if (width < 350)


              this.size = 'modal-alert';


      else if (width < 450)


              this.size = 'modal-sm';


      else if (width < 650)


              this.size = 'modal-md';


      else


              this.size = 'modal-lg';


}