Sunday 31 August 2014

Reading XLSX on android 4 (Post 1)

!!!UPDATE:
All this hacking is getting redundant with Android Build Tools 21+ and Android 5, please see this post for details: http://blog.kondratev.pro/2015/08/reading-xlsx-on-android-4-and-hopefully.html
-----------------

Yesterday I committed XSSF Android usage demo to github:
https://github.com/andruhon/AndroidReadXLSX
The idea is in cleaning jars poi-ooxml and poi-ooxml-schemas from everything which is not necessary to read XLSX format. (just use ZIP archiver to manipulate classes inside, it works well)
This demo already contains reduced poi-ooxml-3.10-reduced.jar and poi-ooxml-schemas-3.10-reduced-more.jar and short building instructions.
Yep, you should use --core-library option to build this project. poi-ooxml depends on xmlbeans and both of them depends on some javax classes which are not available in android. So I have to use StAX library.
UPD: no need in --core-library option any more!

Other posts on reading XLSX on Android:
http://blog.kondratev.pro/2014/09/further-to-my-post-from-yesterday-on.html
http://blog.kondratev.pro/2014/09/reading-xlsx-on-android-3.html

Donate / help
I don't ask for a donation, but you can join me on the LinkedIN and endorse my Java and Android skills if you find this hack useful:
https://nz.linkedin.com/pub/andrei-kondratev/51/445/635

Thursday 7 August 2014

Getting rid of annoying Uncaught TypeError: Cannot read property 'isGroupHeader' of null

"Uncaught TypeError: Cannot read property 'isGroupHeader' of null" in sencha 4.x might be caused by nested grids usage. For example if you have grid with RowExpander rendering another grid into expander.

This happens because grid cell or cell editor event (mouseover, click or whatever) is fired in context of another grid (parent or ancestor).

This override might help (it works fine on 4.2.2 for me):

Ext.define('SystemFox.overrides.view.Table', {
    override: 'Ext.view.Table',
    checkThatContextIsParentGridView: function(e){
        var target = Ext.get(e.target);
        var parentGridView = target.up('.x-grid-view');
        if (this.el != parentGridView) {
            /* event of different grid caused by grids nesting */
            return false;
        } else {
            return true;
        }
    },
    processItemEvent: function(record, row, rowIndex, e) {
        if (e.target && !this.checkThatContextIsParentGridView(e)) {
            return false;
        } else {
            return this.callParent([record, row, rowIndex, e]);
        }
    }
});