简体   繁体   English

JsGrid-自动增量ID

[英]JsGrid - Auto Increment ID

I recently started using JsGrid and I really like it. 我最近开始使用JsGrid,我非常喜欢它。 It is simple to interact with and well documented. 与之交互很简单并且有据可查。

I though face a small issue: 我虽然面临一个小问题:

Whenever I insert a new row in the JsGrid application I get asked an ID. 每当我在JsGrid应用程序中插入新行时,我都会被询问一个ID。 If this ID happens to be the same as an already existing ID, it will give my an error on my MySql database (unique key). 如果此ID恰好与现有ID相同,它将在MySql数据库(唯一键)上给我一个错误。

Is there a way to fill in the ID for the user and make sure he can not alter it while inserting? 有没有一种方法可以为用户填写ID,并确保他在插入时不能更改ID?

Thanks! 谢谢!

Usually ID is generated on the DB level. 通常,ID是在数据库级别上生成的。 So user should not provide the ID for new items. 因此,用户不应提供新商品的ID。 Remove ID field from the grid or just make it readonly, removing the type attribute. 从网格中删除ID字段,或者只是将其设为只读,从而删除type属性。

It's implemented in the sample project, showing how to use jsGrid with PHP + MySQL RESTful backend https://github.com/tabalinas/jsgrid-php . 它在示例项目中实现,显示了如何将jsGrid与PHP + MySQL RESTful后端https://github.com/tabalinas/jsgrid-php结合使用

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

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