首页 \ 问答 \ DHTMLX DataProcessor不保存对数据库的更改(DHTMLX DataProcessor not saving changes to database)

DHTMLX DataProcessor不保存对数据库的更改(DHTMLX DataProcessor not saving changes to database)

我有一个相当简单的DHTMLX页面,我正在努力。 我设法从数据库加载数据并将其显示在DHTMLXGrid中。 但是,当我更改网格中的数据时,数据不会保存到数据库中,因此在重新加载页面时会丢失数据。

有问题的数据库有三个表:用户,节目和观看。 观看是唯一需要更新的(至少现在),我似乎无法让它工作。

这是我的“connector.php”文件

<?php
require("codebase/connector/grid_connector.php");
require("codebase/connector/db_mysqli.php");
$servername     = "nope";
$username       = "nope";
$password       = "nope";
$databaseName   = "nope";
$conn = new mysqli($servername, $username, $password,$databaseName);
$query = "SELECT watching.user_ID, watching.show_ID,shows.name, watching.episodeswatched, shows.episodes, (shows.episodes - watching.episodeswatched) AS episodesremaining, watching.dropped, watching.waiting FROM watching INNER JOIN shows ON watching.show_ID = shows.ID INNER JOIN users ON watching.user_ID=users.ID";
$gridConnector = new GridConnector($conn, "MySQLi");
if($gridConnector->is_select_mode())
    $gridConnector->render_complex_sql($query,"ID","name,episodeswatched,episodes,episodesremaining,dropped,waiting","user_ID,show_ID");
else 
{
    $gridConnector->render_table("watching","ID", "episodeswatched,dropped,waiting","user_ID,show_ID");
}
?>

和Javascript的相关部分一起制作处理器和DHTMLXGrid

showsGrid.init();
showsGrid.load("connector.php");
var myDP = new dataProcessor("connector.php")
myDP.enableDataNames(true);
myDP.init(showsGrid);

我尝试使用相同的行来获取数据和更新(render_complex_sqlquery),但除了将问题的行涂成红色之外什么也没做。 至少用这种方法,行保持黑色。

我错过了什么吗? 我做错了吗? 我已经完全被困在这里太久了,我承认失败了。 我查看了我能找到的每个示例和教程,搜索了文档,但没有找到任何帮助。

忘了GitHub链接: https//github.com/lightspeed1001/dhtmlxdemo


I have a rather simple DHTMLX page that I'm working on. I managed to load data from a database and display it in a DHTMLXGrid. However, when I change data in the grid, the data is not saved to the database and is therefore lost when the page is reloaded.

The database in question is three tables: users, shows and watching. watching is the only one that needs updating (right now at least) and I just can't seem to get it to work.

This is my "connector.php" file

<?php
require("codebase/connector/grid_connector.php");
require("codebase/connector/db_mysqli.php");
$servername     = "nope";
$username       = "nope";
$password       = "nope";
$databaseName   = "nope";
$conn = new mysqli($servername, $username, $password,$databaseName);
$query = "SELECT watching.user_ID, watching.show_ID,shows.name, watching.episodeswatched, shows.episodes, (shows.episodes - watching.episodeswatched) AS episodesremaining, watching.dropped, watching.waiting FROM watching INNER JOIN shows ON watching.show_ID = shows.ID INNER JOIN users ON watching.user_ID=users.ID";
$gridConnector = new GridConnector($conn, "MySQLi");
if($gridConnector->is_select_mode())
    $gridConnector->render_complex_sql($query,"ID","name,episodeswatched,episodes,episodesremaining,dropped,waiting","user_ID,show_ID");
else 
{
    $gridConnector->render_table("watching","ID", "episodeswatched,dropped,waiting","user_ID,show_ID");
}
?>

And the relevant parts of the Javascript to make the processor and DHTMLXGrid

showsGrid.init();
showsGrid.load("connector.php");
var myDP = new dataProcessor("connector.php")
myDP.enableDataNames(true);
myDP.init(showsGrid);

I tried using the same line for fetching data and updating (render_complex_sqlquery) but that does nothing but paint the row in question red. At least with this method the row stays black.

Am I missing something? Am I doing something completely wrong? I've been completely stuck here for way too long and I'm admitting defeat. I've looked at every sample and tutorial I could find, scoured the documentation and found no help for this.

Forgot the GitHub link: https://github.com/lightspeed1001/dhtmlxdemo


原文:https://stackoverflow.com/questions/26951097
更新时间:2023-11-30 11:11

最满意答案

默认成员初始值设定项就是 - 默认值。 它始终允许构造函数提供不同值的可能性。 num2letter可能会从Example的一个构造函数初始化,此时甚至不会使用默认的初始化程序...因此必须明确提供类型。 如果没有初始化程序,声明必须对我们有效。

这与你不能做的事情是一样的:

class Example {
    auto i = 4;
};

A default member initializer is just that - the default. It always allows for the possibility that a constructor will provide a different value. num2letter could potentially be initialized from one of Example's constructors, at which point the default initializer wouldn't even be used... so the type has to be explicitly provided. The declaration has to be valid with our without the initializer.

This is the same reason that you can't do something like:

class Example {
    auto i = 4;
};

相关问答

更多

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)