Quick Fix for AdvancedDataGrid not maintaining widths when data provider refresh

clock January 31, 2016 03:30 by author Flexicious

Recently, we addressed an issue for a customer:

Issue : One thing I have found is that (in some cases) if I set the dataprovider for the datagrid after the datagrid is initially created, the widths are correctly set, but if I set the dataprovider in the mxml code for the grid and bind an array collection to it, the column width settings are not respected.    

 

Another issue we have is that when we change the dataprovider content for the grid, the columns resize themselves after refreshing the dataprovider.  An example project showing this is attached.  In this project, the dataprovider contains a single record and is loaded when the datagrid loads.  When hitting the 'Refresh Data Provider' button at the bottom of the app, I clear the dataprovider, refresh the dataprovider, add the record back to the dataprovider, and then refresh the dataprovider again.  As you can see, the column widths spontaneously resize themselves after the refresh.  Can you please advise as to how we can better control our column widths under these conditions.

Solution:

The problem here is that there are two rounds of code that run to calculate the widths of columns. The first round is the default SDK code - we need it to run to figure out the initial set of column widths. The second pass is our code, which basically adds support for things that are covered using our columnWidthMode. Column Width Modes are an very nuanced topic, as you can observe from this documentation : http://www.flexicious.com/resources/docs29/com/flexicious/nestedtreedatagrid/FlexDataGridColumn.html#columnWidthMode. But irrespective of that - the issue is that once they are calculated, the input for the next round of calculations is not the same as before. So what we have done, is added a property - autoApplyColumnWidths - this will cause the column widths to calculate only once, and that too when you call it. This way, we dont override the initially calculated column widths. 

 

<grids:ExtendedAdvancedDataGrid  id="dgCfgList" 

dataProvider="{devConfigListArr}"

autoApplyColumnWidths="false"

 

And then you manually call applyColumnWidths after you set the data provider - make sure you call validateNow prior to this, so the first pass of the width calculation executes.

devConfigListArr.refresh();

dgCfgList.validateNow();

dgCfgList.setColumnWidthsUsingWidthMode();




Flexicious 3.3 Released

clock January 1, 2016 01:44 by author Flexicious

As we close out a terrific 2015 and ring in 2016, we have been hard at work here at Flexicious wrapping up our newest release 3.3. As with the past couple releases, this one is huge as well, and the full scope of this release has been broken into almost half a dozen individual blog posts that we've been publishing over the past few weeks. As you consume all of this, please keep this in mind - we are and will always be committed to Flex, and our Flex products. We will continue to invest and improve on them - but we ask your help. We are probably among the last few companies still actively developing Flex products. While we've diversified from a technology perspective Flex has always been our favourite stack -its where we feel most at home. Fortunately, we have numerous customers who are just as passionate about the techonology as we are, and have been supporting us via regular renewals. WE thank you and hope we live up to your expectations. For those of you who have not renewed but are still using Flex, please, consider renewing. This gives us the motivation we need to continue to improve and add new features.    

  • Bug Fixes

    • We have a column that can have the values as BLANK (empty string ” “), CAT, and DOG. When I select to filter on BLANK fields, only my column values that contain “ “ will filter, but when I load the preference string into the grid, it does not display my saved filter to be BLANK like it should. It defaults to ALL being selected (BLANK, CAT, DOG).

    • If we have a custom filter render, DynamicFilterControl. The filter works but when we save the preference and the reapply it does not work.

    • Fix for source code could not be compiled with Flex 3.x

    • We have server side persisted preferences.  When I go from a grouped saved preference to a non-grouped filtered preference I loose all data.

    • This only happens in a scenario of grouped to filtered.  If I go from a grouped to sorted or some other simple preference it works correctly.

    • Fixed issue where Print and PDF of grids with horizontal scroll policy auto but columns not wide enough causing last column to stretch cause weird appearance in the print view

    • Added Support for PDF and Export of Grouping Data

    • Added support for column headers to include the full column group text

    • Added support for export and print views to include full column group text.

    • We are no longer able to move columns whenever the Drag Bar Grouping Feature is enabled on the report.

    • When we upgraded to the newest Flexicious, we no longer had the ability to persist the numeric filters when grouping preferences are set.

    • Added column glyph when you are dragging columns (So the user can drag and drop to rearrange columns as well as do the grouping using the Drag Drop grouping)

    • Fixes for drag drop grouping with legacy preferences.

    • If you have an ExtendedAdvancedDataGrid with text input filters, if you also have lockedColumns > 0, then when you type into one of the text input filters, the filter will lose focus after filtering.

    • Fix for textColor - I want my text color in my renderer to stay the color black but it still goes grey even when I set the disabledColor property on the column.  Without the renderer, it works great.

    • Bug fix for label size on treemap/TreeMapPainter.as

    • Fix for XML Exporter not writing out footer.

    • Scroll H-Scroll bar to extreme right. Try to drag any column to the extreme right of the grid. Now try to drag another column, user unable to drag any column if user tries to shift column after last column

    • Bug Fix for fix for LineChartPainter - drawing from 0,0 does not work

    • Fix for able to enter characters like '?' and '*' in the numeric input.

    • Fix for copy selected objects with dynamic levels not working, and checkbox selection with enableStickControlKeySelection false.

  • Enhancements

    • Added support for grid wide column spanning cells. If you return -1 indicates the cell should occupy just its own spot. Any number greater than one would position the cell so it covers the width of that number of cells

    • Added selectedObjectsAtAllLevels - [Read Only] A list of selected objects from the data provider. This is the sdk equivalent of selectedItems. We do not have selectedItems, but selectedObjects will almost always be the same as selectedItems. The only exception is when you use server side paging. In this case, selectedObjects will contain all the items selected, on all pages. When a row is selected in the grid, we store the the selected object in the selectedObects array collection. This allows for multiple pages of data that comes down from the server and not maintained in memory to still keep track of the objects that were selected on other pages. Please note, for hierarchical grids, each level has its own collection of selected keys. The grid.selectedObjects returns the selectedKeys at the top level. To access the selected keys at a lower level, you may navigate to that level using grid.columnLevel.nextLevel...nextLevel.selectedKeys

    • Added support for enableFTERenderer

    • Added support for enableBackground (for grids that don’t paint a background)

    • Made FDGC4 work (for memory)

    • Added Performance improvement - enableStyleCache - http://blog.flexicious.com/post/Upcoming-33-release-Performance-Improvements.aspx

    • Support for clearing grouping criteria – clearGrouping() added to DragDropGroupingBehavior.as

    • Added cellEditEnterKeyTabsToNextEditableCell : By default, the enter key will look for a cell below the current cell. As opposed to the tab key which will navigate to cells starting to the right. Setting this flag to true will cause the user to navigate to the next editable cell (just like the tab key)

    • Changes so that responsive behavior only kicks in once per resize

    • Added documentation for responsive behaviors/ResponsiveBehavior.js

    • Better text rendering for alive pdf printer for multiline text.

    • Updated build scripts to include new files for Responsive code

    • Support for tree map label font size in TreeMap.

    • Added labelFontSizeFunction to TreeMapSeries : Function that determines the label font size. If null, the chart will calculate its own Should take a label Object, a String object, and return a number.

    • Added support for Line Chart Painters to draw broken lines: drawBrokenLines added to LineSeries : When there is a NAN value encountered while drawing a series, we currently just draw a broken line. You can set this flag to false and it will draw through the points to the next real point.

    • All Charts – Support for skipping drawing labels when there is no text returned – One of the biggest things slowing down charts is the issue of drawing a LOT of data points. Each data point requires potentially a label (UIComponent) created – this is especially true for Axes. What this changes does is that via the labelFunction, if you return blank, we don’t draw the label associated with the data point (for an axis, we draw the tick, but not the label on the tick). This allows you to render a lot more data points on the chart with fewer labels.

    • Added allowNoneSelection to MultiSelectComboBox - By default, the combobox does not allow you to select none items. Since it is usually used in search scenarios, you have to select something to search on. However, in cases where you are using the MSCB in non-standard scenarios, setting this flag to true will let the OK button be enabled.




Upcoming 3.3 release - Custom Stylesheets for HTML and Word Exports

clock January 1, 2016 00:48 by author Flexicious

A minor new enhancements to the upcoming 3.3 release is the support for addition of styling information for Word and HTML Exports. You can now add support for backgrounds, borders, fonts, colors, etc to the generated file. The style information is contained in the constants class, and you can modify this:

Below is the default, which you can customize as you see fit. 

 

Constants.HTML_EXPORT_CSS= "<style>"+
   
"table {font-family: Arial, Verdana, sans-serif;border-collapse: collapse; border-spacing: 0; }       "+
   
"td {border: 1px solid #CCC; text-align: center;width: 10em;padding: 1em;}    "+
   
"th {border: 1px solid #CCC; text-align: center;padding: 1em;background-color: #DFDFDF;}"+
   
"tr {height: 1em;}"+
   
"table tr.even {background-color: #F1F1F1;}"+
   
"table tr.footer {border: 1px solid #CCC; text-align: center;padding: 1em;background-color: #DFDFDF;}"+
    
"table tr.odd {background-color:#fefefe;}</style>";

Constants.WORD_EXPORT_CSS= "<style>"+
   
"table {font-family: Arial, Verdana, sans-serif;border-collapse: collapse; border-spacing: 0; }       "+
   
"td {border: 1px solid #CCC; text-align: center;width: 10em;padding: 1em;}    "+
   
"th {border: 1px solid #CCC; text-align: center;padding: 1em;background-color: #DFDFDF;}"+
   
"tr {height: 1em;}"+
   
"table tr.even {background-color: #F1F1F1;}"+
   
"table tr.footer {border: 1px solid #CCC; text-align: center;padding: 1em;background-color: #DFDFDF;}"+
   
"table tr.odd {background-color:#fefefe;}</style>";