phpgrid - 更改编辑路线

时间:2018-02-15 15:34:00

标签: php phpgrid

我在Slim Framework集成中使用phpgrid,我看到phpgrid系统的所有编辑和创建功能都将数据发送到位于phpgrid文件夹内的名为“edit.php”的文件。

有什么方法可以改变它并实际将表单的结果路由到另一个文件,最好是Slim中的控制器?

L.E:值得一提的是,我没有使用数据库连接来处理数据。相反,我使用API​​来获取和处理我的数据,并将数据提供给数组中的phpgrid。

2 个答案:

答案 0 :(得分:1)

Google" phpgrid保存本地数组"发表这篇文章

Save Local Data Array Back to Server via Ajax

您可以使用jQuery ajax帖子中的更改提交到您选择的任何网址

Demo

<script src="http://malsup.github.com/jquery.form.js"></script>
<form id="admin_form">
    <div>
        <input type="submit" value="Submit Local Changes">
    </div>
</form>

<script>
    $(function() {
        // bind to the form's submit event
        $('#admin_form').submit(function(event) {
            $(this).ajaxSubmit({
                type: 'post',
                dataType:'json',
                url:'save_local_array.php',
                data:{
                    langArray:[] //leave as empty array here
                },
                beforeSubmit: function(arr, $form, options){
                    options.langArray = $('#data1').jqGrid('getRowData'); //current
                    console.log(JSON.stringify(options.langArray));
                    // return false; // here to prevent submit
                },
                success: function(){
                    // add routine here when success
                }
            });

            // return false to prevent normal browser submit and page navigation
            return false;
        });
    });
</script>

答案 1 :(得分:0)

通过仔细检查文档,在隐藏的地方无法清楚地搜索它的情况下,有一种方法称为:set_js_editurl()

此方法允许您设置自己的URL,其他所有内容都相同:)

快乐的编码, 战神D.