刷新handsontable [英] Refresh a handsontable

查看:181
本文介绍了刷新handsontable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想刷新一个可动手操作的网格.我有一些带有下拉列表的列,其中填充了数据库的数据.但是在我的页面中,我有第一个网格,该网格将数据插入到该数据库中,并将它们放入第二个网格中.但是由于我的第二个网格未刷新,因此无法获得仅插入第一个网格中的最后一个值.

I want to refresh a handsontable grid. I have some columns with a dropdown filled with data of my database. But in my page, I have a first grid which insert data in this database and I get them in my second grid. But as my second grid is not refresh, I can't get the last value I just insert in the first grid.

那么我该如何刷新handontable的内容?

So how can I refresh the content of a handsontable please ?

我做了一个jsfiddle来说明我的问题: http://jsfiddle.net/9onuhpn7/10/ 在我的jsFiddle上,它可以正常工作,当我将它们压入数组时就可以获取它们的值.但是,对于我的实际应用程序和数据库,这是行不通的.

I made a jsfiddle which illustrate my problem : http://jsfiddle.net/9onuhpn7/10/ On my jsFiddle, it works and I can get the values when I push them in the array. But with my real application, and with a database, it doesn't work.

因此,我在代码中使用了它(而不是数组)(它可以工作,但是没有刷新):

So instead of an array, I have this in my code (it works but it's not refreshed) :

columns:[
<?php 

    $conn_string = "host=localhost port=5432 dbname=test_postgre user=postgres password='1234'";
    $dbconn = pg_connect($conn_string);

    $sql = "SELECT ".$colonne." FROM public.".$tablevar."";
    $res = pg_query($sql) or die("Pb avec la requete: $sql");

    $data = pg_fetch_all($res);

    $indexedOnly = array();

    foreach ($data as $row) {
                $indexedOnly[] = array_values($row);
    }
    echo '{type:\'dropdown\',';
    echo 'source:'.json_encode($indexedOnly).'},';



?>]

推荐答案

只需调用hot.render();,其中hot引用Handsontable对象.

Just call hot.render();, where hot refers to the Handsontable object.

对我来说很棒.

这篇关于刷新handsontable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆