【问题标题】:Couple newbie questions regarding the openJS grid关于 openJS 网格的几个新手问题
【发布时间】:2014-03-27 13:03:02
【问题描述】:

我正在玩 openJS 网格。浏览了所有视频,但仍然卡住了。我正在使用最新的 OpenJS Grid 2.1.5。这里有几个问题:

  1. 当我使用基本设置示例时,将保存和删除设置为 true,我看不到任何一个出现在网格中。我错过了什么?

  2. 如何更改主题?该示例只有白色背景主题。我想将其更改为类似于视频教程深色主题的内容。我该怎么做?

  3. 如何选择行,突出显示列?我单击该列,它只是进行排序。点击单元格,它不会选择行,也不会像视频所示将其放在顶部。

谢谢,

魏,

html文件

<!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="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"/>
    <script src="../jquery.js" type="text/javascript"></script>
    <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript">    </script>
    <script src="../root.js"></script>
    <script src="../grid.js"></script>

    <script type="text/javascript">
        $(function() {
            $(".purchases").grid();
        });
    </script>
</head>
<body>
    <h2>Insider Purphases</h2>
    <table class="grid purchases" action="insider.php">
      <tr>
        <th col="Insider">Insider Name</th>
        <th col="Company">Company</th>
        <th col="Symbol">Symbol</th>
        <th col="Amount">Amount</th>
        <th col="Relationship">Relationship</th>
        <th col="Date">Date</th>
      </tr>
    </table>
</body>
</html>

php 文件

<?php
// connect to db
mysql_connect("localhost","root","");
mysql_select_db("insidertrades");

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

// load our grid with a table
$grid = new Grid("purchases", array(
    "save"=>true,
    "delete"=>true
));
?>

【问题讨论】:

    标签: php mysql grid


    【解决方案1】:

    好的,至少在javascript中打开编辑标志带回有意义的“保存”按钮。

            <script type="text/javascript">
            $(function() {
                $(".purchases").grid({
                  editing:true
               });
            });
        </script>
    

    【讨论】:

      【解决方案2】:

      哇,抱歉,我直到 10 个月后才看到这个。我没有针对 OpenJS Grid 问题监控堆栈。

      1) 你需要在 JS 和 PHP 上打开保存和删除等功能(这是为了安全,我保证这是必要的邪恶)

      2) CSS 我的朋友。只需一点 CSS 就可以了。 grid.css 文件有完整的注释。这次我没有制作易于切换的主题。没有人使用这些。

      3) 要突出显示列,请添加

      $grid.on("cellClick", function(e,$cell) {
          $cell.closest(".col").find(".cell[data-row]").css("background","blue")
      });
      

      只是给你一个想法。如果您还没有,请更新到 2.1.7。

      谢谢!

      【讨论】:

        猜你喜欢
        • 2011-11-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多