使用HTML表格中的Phonegap保存CSV文件

时间:2016-02-22 13:39:31

标签: javascript android jquery cordova csv

我正在开发Phonegap上的Android 4.4.4应用程序。

我不允许使用PHP或任何在线服务,因此我必须在没有用户访问互联网的情况下解决此问题。这是我的第一个Phonegap项目,我对大多数事情并不熟悉。

示例表将是这样的:

Array
(
    [0] => Array
        (
            [id] => 1
            [parent_id] => 0
            [title] => Shoes
            [description] => This is the shoes main category
            [image] => 
            [created_at] => 2016-02-18 14:22:56
            [updated_at] => 2016-02-18 14:22:56
            [active] => 
        )

    [1] => Array
        (
            [id] => 2
            [parent_id] => 1
            [title] => Sub-shoes
            [description] => This is sub-category of shoes
            [image] => 
            [created_at] => 2016-02-18 14:27:44
            [updated_at] => 2016-02-18 14:27:44
            [active] => 
        )

    [2] => Array
        (
            [id] => 8
            [parent_id] => 2
            [title] => Sub-sub-shoes
            [description] => This is sub-sub-shoes category
            [image] => 
            [created_at] => 2016-02-21 13:32:44
            [updated_at] => 2016-02-21 13:32:44
            [active] => 
        )

    [3] => Array
        (
            [id] => 5
            [parent_id] => 1
            [title] => Sub-shoes 2
            [description] => This is sub-shoes category after deleting the first of it's kind
            [image] => 
            [created_at] => 2016-02-18 14:40:33
            [updated_at] => 2016-02-18 14:40:33
            [active] => 
        )

    [4] => Array
        (
            [id] => 3
            [parent_id] => 0
            [title] => Dresses
            [description] => This is the main dress category
            [image] => 
            [created_at] => 2016-02-18 14:33:41
            [updated_at] => 2016-02-18 14:33:41
            [active] => 
        )

然后我想"下载CSV!"按钮将表格保存为CSV文件。

我在这里尝试了这个方法:https://jsfiddle.net/terryyounghk/kpegu/ 它在浏览器端工作正常,但在手机/平板电脑上它不能下载任何东西。

所以我正在寻找另一种从Table

下载CSV的方法

感谢您花时间阅读本文。

0 个答案:

没有答案