Page 1 of 1

Grid workflow improvements

Posted: Wed Jan 07, 2015 12:16 pm
by jmurtha
Dealertrack has been a profound ui customer for some time now. Our product management group is systematically reviewing common user navigation paths and looking for ways to further improve end user functionality and efficiency. One aspect of this focus is on workflow improvements to grid sequence selection.

The legacy product allowed users to select a column for sequencing from a list (not all grid columns are supported). By selecting a column the program would reload the grid, sorting rows by the selected column. I want to implement this functionality by allowing users to click on supported column heading. This a modified version of the grid sort functionality that profound supports, but I need only specific columns to be selectable. Are there any suggested approaches to implementing this type of behavior?

Could a hyper link widget be added to appropriate column headings, could a combination of java script and field binding(s) be used to determine the appropriate state of the column (unselected, ascending or descending) coordinate the visual representation of the links? My question is how can a link image be dynamically changed via java script? Can a CSS class property be used to indicate which image profound should use when rendering the widget? Are there any examples I could reference?

Thanks for you help.

Re: Grid workflow improvements

Posted: Wed Jan 07, 2015 12:27 pm
by Scott Klement
There is a grid property called 'column sort response' that you can bind to a variable. When someone clicks on a column heading, it will return control to your RPG program, and the column number that they clicked will be placed into the variable.

Your RPG program can then sort the subfile however it wants.

Or, if your RPG program knows that a particular column should not be sortable, it can simply do nothing.

Will that work for you? Or are you looking for something else?

Re: Grid workflow improvements

Posted: Wed Jan 07, 2015 4:39 pm
by mpilo0
Hi, we had the same issue. We went completely around this issue by adding our own button in the headers that allow ascending or descending sort. The sort is then handled server side. This is what it looks like:
Grid.jpg
Grid.jpg (11.7 KiB) Viewed 1385 times
The only thing you have to watch out for is if you use "Movable Columns". If you do then you will have to use the "_total" bypass trick (If you decide to go with this and it is an issue I can explain into further details).

We also did this in order to ignore case sensitive sorting. We want to ignore the case in our sorting, so we do so by setting an SQL option that ignores all cases and special characters. Basically everything works exactly like we want it to. Our sorting is handled server side, it is easy for users to see which columns are sortable and we get to sort only the columns we need.

If this solution interests you, let me know and i will explain into further details how to achieve this result.

Re: Grid workflow improvements

Posted: Wed Jan 07, 2015 4:54 pm
by jimr
hi pilo

I'd be interested in more detail. The other "advantage" of your method is that it can be used in cases where a full subfile load is not possible.

Thanks,
Jim

Re: Grid workflow improvements

Posted: Wed Jan 07, 2015 5:30 pm
by mpilo0
Yes, it is indeed the case. Basically what we do is simply name all of the little arrows as we wish.

If you are using movable columns:
You need to add another image in the grid with the same id. You will then add to the one in the header "_total" to the id. Profound will automatically manage this and move the arrows to the same position as the ones in the grid. You will obviously put visibility to none on the image in the grid but you will need to position to the same "y position" as the one in the header. In your designer it will look something like this:
Sort Button.jpg
Sort Button.jpg (120.8 KiB) Viewed 1376 times
Now, in your RPG you will do something like this:

Code: Select all

	Dcl-C C_PUI_SortAscendImageOff '/profoundui/userdata/redarrow';
	Dcl-C C_PUI_SortAscendImageOn  '/profoundui/userdata/bluearrow';

    Select;
            When S1_Btn_Exit;
                  i_Exit = *On;
                  
             //Other code 
             
             When H1_In.S1_Btn_Code_Sort_Asc_total  = *On Or
                  H1_In.S1_Btn_Code_Sort_Desc_total = *On Or
                  H1_In.S1_Btn_Desc_Sort_Asc_total   = *On Or
                  H1_In.S1_Btn_Desc_Sort_Desc_total  = *On;

               ExSr R_UI_TurnOffAllSortedColumns;
               //Reload Screen 
    EndSl;
    
    BegSr R_UI_TurnOffAllSortedColumns;

           H1_Out.S1_Btn_Code_Sort_Asc_Src   = C_PUI_SortAscendImageOff;
           H1_In.S1_Btn_Code_Sort_Asc_Src      = C_PUI_SortAscendImageOff;
           H1_Out.S1_Btn_Code_Sort_Desc_Src  = C_PUI_SortDescendImageOff;
           H1_In.S1_Btn_Code_Sort_Desc_Src    = C_PUI_SortDescendImageOff;
           H1_Out.S1_Btn_Desc_Sort_Asc_Src    = C_PUI_SortAscendImageOff;
           H1_In.S1_Btn_Desc_Sort_Asc_Src       = C_PUI_SortAscendImageOff;
           H1_Out.S1_Btn_Desc_Sort_Desc_Src  = C_PUI_SortDescendImageOff;
           H1_In.S1_Btn_Desc_Sort_Desc_Src    = C_PUI_SortDescendImageOff;

   EndSr;   
    
 
Please note that the only reason we have to do this both in the H1_In and the H1_Out is because we are using a qualified file for the screen definition in order to use the Alias names. If you dont use aliases, then you can simply remove the qualification in front of everything therefore removing have the lines in the R_UI_TurnOffAllSortedColumns SR. You could also put all of these in a DS and clear the said DS. There are many tricks that could be done. But for the fact of simplicity lets just leave it like this.

Later on in the program you can then determine your sort by verifying the link in the "S1_Btn_Desc_Sort_Desc_Src" variable. This is also what will make the arrow the right color. (Note that we do this in SQL, so i will give this as an example.)

Code: Select all

           Select;
             //If button was clicked or the source is already ok, then set the field in the "out" and build your sql order by. 
             When H1_In.S1_Btn_Code_Sort_Asc_total = *On Or
                  H1_In.S1_Btn_Code_Sort_Asc_Src = C_PUI_SortAscendImageOn;

               H1_Out.S1_Btn_Code_Sort_Asc_Src = C_PUI_SortAscendImageOn;
               w_SqlOrderBy += ' FieldNameCode ASC';

             //If button was clicked or the source is already ok, then set the field in the "out" and build your sql order by. 
             When H1_In.S1_Btn_Code_Sort_Desc_total = *On Or
                  H1_In.S1_Btn_Code_Sort_Desc_src = C_PUI_SortDescendImageOn;

               H1_Out.S1_Btn_Code_Sort_Desc_src = C_PUI_SortDescendImageOn;
               w_SqlOrderBy += ' FieldNameCode DESC';
           EndSl;
Your sort is now completely handled server side as you wish. If any of you need the sql option to ignore the case or if you have any other questions, let me know.

Michael