[Logo] OLD FORUM - Use new one: https://www.CaptainCasa.online/forum
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Columns of a fixgrid  XML
Forum Index -> Development - Code Snippets
Author Message
tdrasch

Power User
[Avatar]

Joined: 13/03/2009 19:09:45
Messages: 81
Location: Villingen-Schwenningen
Offline

with the captain-casa-function 'onEditColumnDetails' you can manage the columns of a fixgrid.

with another function (e.g.) 'safeActualState' you can safe which columns are shown in the moment e.g. in a database.

here a little example:

first we need a little model class for the layout

Code:
 public class Layouts {
 	String m_jspName;
 	String m_variant_id ;
 	String m_pernr;
 	String m_gridName;
 	String m_colSequ;
 	String m_colWidth;
 	...
 	//getters and setters!
 


now a button is called on your UI with binds this function in your grid.

Code:
 public void saveActualState(InteractionObjectGrid selectedGrid, String gridName)
 {
   if (gridName != null && !(gridName.equals(""))){
     Layouts layouts = new Layouts();
     layouts.setColSequ(selectedGrid.getColumnsequence());
     layouts.setColWidth(selectedGrid.getModcolumnwidths());
     //gridLayout.setJspName()
     layouts.setGridName(gridName);
     layouts.setJspName(getScreenName());
 
     //initialize db-connection
     //at this point you have to do an insert or an update in your database table structure.
   }
 }	
 


now on every new-load of our page (UI) we load the grid and the state safed in the database.

--------------------------------
Good karma - for the moment...
why is the word abbreviation so long?
[WWW]
tdrasch

Power User
[Avatar]

Joined: 13/03/2009 19:09:45
Messages: 81
Location: Villingen-Schwenningen
Offline

snippet of the load of the columns...

we have developed a simple model class to support the load:

Code:
 public class ColumnProp {
   String	m_colSequence;
   String 	m_colWidth;
   ...
   //getters and setters!
 }
 


then get the columns of the grid from the db and set it to the grid

Code:
 do {
   ColumnProp colProp = new ColumnProp();
   colProp.setColSequence(tds[1].getString("col_seq")); 
   colProp.setColWidth(tds[1].getString("col_width"));
   setGridColumnProps(tds[1].getString("grid_name"),colProp);
 } while (tds[1].next());
 


and at last the method to set the columns to a grid

Code:
 public void setGridColumnProps(String key, ColumnProp colProp) {
   if (key != null && !(key.equals(""))){
     InteractionObjectGrid grd = m_gridCol.get(key);
     if (grd != null) {
       if (colProp.getColSequence() != null && !(colProp.getColSequence().equals("")) ){
         grd.setColumnsequence(colProp.getColSequence());	   		
       }
       if (colProp.getColWidth() != null && !(colProp.getColWidth().equals("")) ){
         grd.setModcolumnwidths(colProp.getColWidth());	   		
       }
     }
   }
 }
 

--------------------------------
Good karma - for the moment...
why is the word abbreviation so long?
[WWW]
 
Forum Index -> Development - Code Snippets
Go to:   
Powered by JForum 2.1.6 © JForum Team