2013-05-20 99 views
1

我正在玩openJS網格。通過所有的視頻,但仍然卡住。我正在使用最新的OpenJS Grid 2.1.5。夫婦的問題在這裏:有關openJS網格的新手問題

  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 
)); 
?> 

回答

1

確定,至少翻了編輯標誌在JavaScript帶回「保存」按鈕w這很有道理。

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

很抱歉我在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。

謝謝!