0

私はopenjsグリッドv2.1をテストしてきました-ajax.phpとindex.phpを変更することから始めます-グリッドにデータを表示させることができます、削除機能、並べ替え、ナビゲーションは機能しますが、インライン編集を取得できないようです働いて、私はすべてを試しました、古いバージョンのユーチューブビデオを見ました、グーグルを検索しました、何時間も試しました-私は立ち往生しています!

私のテーブルには主キー「id」があります

ajax.php

<?php
    // connect to db
    mysql_connect("localhost","user","pass");
    mysql_select_db("db");

    // require our class
    require_once("grid.php");

    // load our grid with a table
    $grid = new Grid("phpbb_rivals_players", array(
        "save"=>true,
        "delete"=>true,
        "editing"=>true,
        "where"=>"Console = 'PS3'",
        "select" => 'selectFunction'
    ));

    // drop down function
    // if you have anonymous function support, then you can just put this function in place of
    // 'selectFunction'
    function selectFunction($grid) {
        $selects = array();

        // category select
        $grid->table = "phpbb_rivals_players";
        $selects["id"] = $grid->makeSelect("id","ForumID");

        // active select
        $selects["active"] = array("1"=>"true","0"=>"false");

        // render data          
        $grid->render($selects);
    }


?>

index.php

<!DOCTYPE html>
<html lang="en">
    <head>

        <link rel="stylesheet" href="bootstrap/css/bootstrap.css"/>

        <link rel="stylesheet" href="grid.css" title="openJsGrid"/>
        <!--<link rel="stylesheet" href="jquery-ui/css/smoothness/jquery-ui-1.8.22.custom.css"/>-->
        <script src="jquery.js" type="text/javascript"></script>
        <!--<script src="jquery-ui/js/jquery-ui-1.8.22.custom.min.js" type="text/javascript"></script>-->
        <script src="root.js"></script>
        <script src="grid.js"></script>

        <script type="text/javascript">
            $(function() {


                $(".users").grid({
                    title : "users",
                    page : 1,
                    showPager : true,
                    editing : true,
                    nRowsShowing : 10,
                    width: 800,
                    editing: true,
                    deleting : true
                }).on("loadComplete",function(e) {
                    //console.log("loadComplete", this.instance);
                }).on("cellClick",function(e, $cell) {
                    //console.log("cell",$cell);
                }).on("rowCheck",function(e, $checkbox) {
                    //console.log("rowCheck",$checkbox);
                }).on("rowClick",function(e, $rows) {
                    //console.log("rowClick",$rows);
                });

            });
        </script>
    </head>
    <body>
        <h2>Players</h2>
        <table class="grid users" action="ajax.php">
            <tr>    
                <th col="id" width="50">id</th>
                <th col="ForumID">ForumID</th>
                <th col="GTPSN">GTPSN</th>
                <th col="Position">Position</th>
                <th col="Formation">Formation</th>
            </tr>
        </table>
    </body>
</html>

GTPSN、Position、Formation、Consoleなどを編集できるようにしたい...

4

1 に答える 1

1

開発者は親切にもgithubで私の質問に答えてくれました!

テーブルhtmlで、set type = "text"-元のドキュメントから省略されていたため、追加されます。

        <table class="grid users" action="ajax.php">
        <tr>    
            <th col="id" width="50">id</th>
            <th col="ForumID">ForumID</th>
            <th col="GTPSN">GTPSN</th>
            <th col="Position">Position</th>
            <th col="Formation">Formation</th>
        </tr>
    </table>

する必要があります

        <table class="grid users" action="ajax.php">
        <tr>    
            <th col="id" width="50">id</th>
            <th col="ForumID">ForumID</th>
            <th type="text" col="GTPSN">GTPSN</th>
            <th type="text" col="Position">Position</th>
            <th type="text" col="Formation">Formation</th>
        </tr>
    </table>

この素晴らしいツールの開発者への称賛..バックエンドの管理コントロールパネルを構築する人への素晴らしい追加!

于 2013-01-20T16:17:23.937 に答える