简体   繁体   English

PHPGrid和事件jqGridAddEditAfterSubmit - 在保存之前操纵数据

[英]PHPGrid and Event jqGridAddEditAfterSubmit - to manipulate data before saving

relatively new to PHPGrid (basically a wrapper for jqGrid as far as I understand), I have a somewhat simple problem I do not seem to be able to find a solution for: 相对较新的PHPGrid (据我所知,基本上是jqGrid的包装器),我有一个简单的问题,我似乎无法找到解决方案:

  • before saving a row in a grid, set column C based on evaluations of columns A and B. (It's not a formula, but an evaluation stating "if B <> NULL then C=B else C=A"). 在网格中保存行之前,根据列A和B的评估设置列C.(这不是公式,而是评估“如果B <> NULL,则C = B,否则C = A”)。

It may seem stupid to manipulate data like this, but it is a consequence of nightly batch updating and day-time entering of "override values". 操纵这样的数据似乎很愚蠢,但这是夜间批量更新和日间输入“覆盖值”的结果。 (By the way, columns A and B are from different tables). (顺便说一下,A列和B列来自不同的表格)。

I've tried various techniques, such as using a trigger on an extra table (as triggers in mySQL can not update the table the trigger is defined for), but this has been deemed too slow (besides it a less-than-gifted way of doing things, right?). 我已经尝试了各种技术,例如在额外的表上使用触发器(因为mySQL中的触发器无法更新触发器定义的表),但这被认为太慢了(除了它不是一个有天赋的方式做事,对吗?)。

Right now I am looking to use an event to manipulate the row before saving it. 现在我希望在保存之前使用事件来操作行。 It should be easy, right? 应该很容易,对吗?

  1. Is the event jqGridAddEditAfterSubmit the right one? 事件jqGridAddEditAfterSubmit是正确的吗?
  2. If so, which parameters does it take - there does not seem to be any documentation available? 如果是这样,它需要哪些参数 - 似乎没有任何文件可用?
  3. Will it suffice to simple implement above mentioned manipulation and "leave it alone" to do the database updating ???? 是否足以简单地实现上述操作并“不管它”来进行数据库更新????

Any pointers will be greatly appreciated ! 任何指针将不胜感激!

Lars 拉尔斯

"as triggers in mySQL can not update the table the trigger is defined for", why is that? “因为mySQL中的触发器无法更新触发器定义的表”,为什么会这样? Did you check the table permission? 你检查了餐桌的许可吗? You should upgrade your grant tables so that they contain the trigger-related privileges. 您应该升级授权表,以便它们包含与触发器相关的权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM