Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Contributor
Posts: 23
Registered: ‎11-09-2015
Accepted Solution

How to create a Scrollable FormTable?

Hi could someone please help me to create a formtable that can be scrolled?

I have too many columns to fit on one page. 

 

Thanks!

Frequent Contributor
Posts: 90
Registered: ‎10-13-2015

Re: How to create a Scrollable FormTable?

[ Edited ]

Scrolling is enabled by default. It does not show up because the width of the columns is set to auto-fit mode. You can override the default behavior in a custom script and set a fixed width for each column like this (version 2015):

 

(function (IG) {
  IG.register.customColumnTemplate("YourFormTable", function (defaultColumns, idField) {   
    defaultColumns.forEach(function(column){
      if(column.field!==undefined && column.field!==idField){
        var toCustomize2 = IG.util.table.getColumn(defaultColumns, column.field);
        toCustomize2.width = 20;
      }
    });
    return defaultColumns;
  });
})(IG);

 

Please adopt  “YourFormTable” to actually use your FormTable and the width (in this sample set to 20px).

 

Hope this helps,

 

Jakub

Contributor
Posts: 23
Registered: ‎11-09-2015

Re: How to create a Scrollable FormTable?

Thanks Jakub!

Contributor
Posts: 23
Registered: ‎11-09-2015

Re: How to create a Scrollable FormTable?

Hi Jakub

 

I'm having a slight problem. After implementing the customization, my row action seems to be missing/not visible.

Any ideas?

 

Thanks

Anchen

Frequent Contributor
Posts: 90
Registered: ‎10-13-2015

Re: How to create a Scrollable FormTable?

Hi Anchen,

 

you have to take care of ACTION_COLUMN, please try

 

  IG.register.customColumnTemplate("tblDilyDokumentace", function (defaultColumns, idField) {    
    defaultColumns.forEach(function(column){
      if(column.field!==undefined && column.field!==idField){
       	var toCustomize2 = IG.util.table.getColumn(defaultColumns, column.field);
       	toCustomize2.width = 300;
      } else if (column.field==undefined && column.id=='ACTION_COLUMN') {
       	var toCustomize2 = IG.util.table.getColumn(defaultColumns, column.field);
       	toCustomize2.width = 300;		  
	  }
    });
    return defaultColumns;
  });

 

because ACTION_COLUMN has no field property.

 

Jakub

Contributor
Posts: 23
Registered: ‎11-09-2015

Re: How to create a Scrollable FormTable?

Hi Jakub, I've tried this sollution. This affects my checkbox (Selection) column but my action column is still not visible.

Frequent Contributor
Posts: 90
Registered: ‎10-13-2015

Re: How to create a Scrollable FormTable?

Check this out, I tried it before on the table with selectionmode="none", in that case it works properly. Modification below should work for both cases with/without checkboxes

 

IG.vent.on('form:before:ready', function () { 
  IG.register.customColumnTemplate("tblDilyDokumentace", function (defaultColumns, idField) {    
		defaultColumns.forEach(function(column){
			//part for "usual" columns
		  if(column.field!==undefined && column.field!==idField)
		  {
			var toCustomize2 = IG.util.table.getColumn(defaultColumns, column.field);
			toCustomize2.width = 300;
			
		  } //part for ACTION_COLUMN
		  else if (column.field==undefined && column.id=='ACTION_COLUMN') 
		  {
				defaultColumns[defaultColumns.length-1].width = 300;		  
		  } //part for CheckBoxes - first column
		  else if (column.field==undefined && column.title=='Checkboxes') 
		  {
				defaultColumns[0].width = 300;  
		  }
		  });
		return defaultColumns;
	  });
	 
});
Contributor
Posts: 23
Registered: ‎11-09-2015

Re: How to create a Scrollable FormTable?

Thanks, working nowSmiley Very Happy

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.