[ 
https://issues.apache.org/jira/browse/FLEX-35224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15804414#comment-15804414
 ] 

Pan Li commented on FLEX-35224:
-------------------------------

I had created DataGrid using beads, it is not meant to be last solution so I 
didn't tune some minor issues.
I uploaded files:
1 my changes to (local) SDK
2 I also include my new files as a zip file ( I suppose it is easier to check 
since you don't need to apply the patch to read it)
3 my testing project. 

The testing project is just the SDK DataGridExample, except that I override the 
data grid beads
{code}
<fx:Style>
                @namespace js "library://ns.apache.org/flexjs/basic";
                @namespace internal "org.apache.flex.html.supportClasses.*"; 
                @namespace html "library://ns.apache.org/flexjs/html";
js|DataGrid
{

        IBeadView: 
ClassReference("org.apache.flex.html.beads.PagingDataGridView");
        IBeadModel: 
ClassReference("org.apache.flex.html.beads.models.PagingDataGridModel");
        IBeadLayout: 
ClassReference("org.apache.flex.html.beads.layouts.PagingDataGridLayout");
        

}


js|DataGridColumnList {

        IDataProviderItemRendererMapper: 
ClassReference("org.apache.flex.html.beads.PagingDataItemRendererFactoryForArrayList");

}

</fx:Style>
{code}

My control includes:
PagingDataGridModel.as    :  the original datagrid model with "page" and 
"pageSize", the pageSize property is hardcoded to 5 still, it is needs to be a 
property which can be set in mxml, then I need to create my own PagingDataGrid 
as well.

PagingDataGridView.as  :  add a footer with the paging buttons
PagingDataItemRendererFactoryForArrayList.as : it is updated to call the paging 
model
{code}
                        var n:int = dp.length; 
                        //for (var i:int = 0; i < n; i++)
                        for (var i:int = pagedModel.firstIndexInPage ; i < 
pagedModel.lastIndexInPage; i++)
{code}
PagingDataGridLayout.as : layout updated for new PagingDataGridView

and necessary updates to HTMLClasses and basic-manifest.xml



But I don't think it is final solution
Our requirement is simple : 
1 we need paging in datagrid (and sorting, filter etc like average datagrid) 
2 we expect it to still work with further FlexJS SDK

If we do the datagrid this way, we are basically duplicating important DataGrid 
logic in new set of beads, the problems are:
it is complex
if FlexJS SDK changes logic of DataGrid, then our custom control will be broken
if FlexJS SDK adds more features to DataGrid, then our custom control won't 
have the improvements
so unfortunately this solution doesn't resolve our requirement.

There are other approaches
1 Custom mxml control as I submit already, it is fairly simple.
2 As Joel suggested earlier in comment, we could add a new ArrayList to SDK, it 
can do logic of 
PagingDataGridModel
and  
PagingDataItemRendererFactoryForArrayList
for the buttons, Joel suggested we add in in mxml
we also have some working code for this approach.
3 If the SDK DataGrid is updated to provide "data filtering bead" (called in  
PagingDataItemRendererFactoryForArrayList?) and "add controls to footer bead", 
then what we need in paging (and other features) can all be done with simple 
beads.



> DataGrid doesn't support paging on large data set
> -------------------------------------------------
>
>                 Key: FLEX-35224
>                 URL: https://issues.apache.org/jira/browse/FLEX-35224
>             Project: Apache Flex
>          Issue Type: Improvement
>            Reporter: Pan Li
>            Priority: Minor
>         Attachments: screenshot-1.png, src.zip
>
>
> expected:
> Gird should support paging if data collection is large
> !screenshot-1.png!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to