简体   繁体   English

PHP在CSV和jQuery数据表

[英]Php on csv and Jquery Datatable

I struggling with a problem for a day but could not come up with a good idea how to handle the following: I have a parsed CSV file what I'm rendering in a Jquery datatable. 我每天都在为一个问题而苦苦挣扎,但是却想不出如何处理以下问题的好主意:我有一个解析的CSV文件,该文件是我在Jquery数据表中呈现的内容。 To each row is appended a checkbox. 每一行都附加一个复选框。 If rows are selected and submitted, the selected lines from CSV file should be deleted. 如果选择并提交了行,则应删除CSV文件中选择的行。 My problem is how to give an id to CSV lines what would be unique even if a row is deleted or others are added. 我的问题是如何为CSV行赋予ID,即使删除一行或添加其他行,这也是唯一的。 Should be managed with PHP or there would be a better solution with Jquery? 应该使用PHP进行管理,还是使用Jquery提供更好的解决方案?

I'd dump the csv to a temporary database table that had an auto_increment primary key. 我将csv转储到具有auto_increment主键的临时数据库表中。 Then the db takes care of maintaining state. 然后,数据库负责维护状态。 Your jQuery datatable would have a hidden column to hold the primary key which acts as a unique identifier for each row. 您的jQuery数据表将有一个隐藏的列来保存主键,该键充当每一行的唯一标识符。

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

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