htmlTable Create and Delete

The extension htmlTable is perfect for what my project needs are but does it support creating and deleting rows? If so, how is this done? If not, what would be the easiest/best way to modify the extension to support this? I don’t expect anyone to do the code for me, but rather point me in the right direction.

What would make this perfect is adding a rightmost column with a X graphic for the delete. And add an empty row at the bottom of the grid for adding a row.

PS: I would have posted this comment directly as a comment for the extension but this site does not allow the posting of comments for new users.


In its current state the widget does not implement adding or deleting records out of the box. However, It should be straight-forward through an AJAX call.

For adding records (without validation) the basic idea can be broken down into the following steps:


[*]Add an "Add new" button to the table header.

[*]Tie this new button to a js script that opens the widget form for data entry

[*]Upon clicking “Ok” in the form, add the TR element with it’s data to the table and mark it for uploading (similar approach to marking TR’s when one has been edited)

[*]Send to the specified controller/action the marked rows through jquery’s ajax post

[*]Handle the insertion of data in the controller/action and return ok

[*]Unmark the new rows when a 200 ajax response is received.


For deletions, I think you could just use the editable feature and add a delete button in the form. When clicked the deleted row will be marked for deletion and when the send button is clicked you will send an ajax request to a controller/action for deletion of the record that matches the data sent.

These are my thoughts, let me know what you think.


Thank you for your response. I think I will look into other solutions for this because the table that I am adding and deleting from has dependent validations that need to occur. (It’s a timelog table) Each record depends on others in the table and there must not be overlaps for the dates. I’m currently experimenting with the GroupGridView extension which is very similar with the standard Yii CGridView.

I do however love how you tie all the screens into one via ajax and dynamic forms. Keep up the good work!