Page 1 of 1

Two issues with widget:type=grid

PostPosted: Fri Oct 15, 2010 5:59 pm
by semicon_guy
I have been using xataface and am very impressed. The widget:type=grid in particular allows for very fast data entry and improves functionality dramatically!

I have encountered two issues with the widget:type=grid tool that I haven't been able to figure out:

1) Sometimes it inserts a bad value of "0" into the database when a new row in a one-to-many field is created and when "Please Select ...." is accidentally selected on previous row.
2) Once a sub-form value is created and saved, there doesn't appear to be a way in the GUI to delete it unless you go to a sub-tab.


Let me provide more detail...

Currently, my fields.ini code is:
Code: Select all
[SubType1]
order=10
transient=1
relationship=SubType1
widget:type=grid
widget:columns="SubType1ID"


And my code in relationships.ini is:
Code: Select all
[SubType1]
tblProductSubType1.ProductID = "$ProductID"


If I am adding a new entry in the Product table, I can add multiple SubType1s for a given Product. I can keep on selecting new SubType1s, and new dropdown menus keep on appearing (which is great!). However, if I change a previous SubType1 value back to "Please Select...", then a value of 0 gets inserted into my tblProductSubType1 table. Instead, it just shouldn't insert a row.

I realize that by clicking the red "X" things I can get rid of the bad rows before clicking "Save", however it still is troublesome that I can pollute my database with bad values. I tried using form validation to catch this but didn't have success.

The second problem is probably just a feature request - it would be great to be able to dynamically delete these sub-form values after they are saved to the database! The widget:type=grid is great for dynamically adding records, but I can't seem to get it to allow me to dynamically delete records! There are probably some reasons why this isn't allowed. If dynamic deletion isn't possible, it could be possible to put a little check box next to each records that said "Delete?" and allowed you to delete them after save.

Thanks!!

Re: Two issues with widget:type=grid

PostPosted: Tue Oct 19, 2010 11:12 am
by semicon_guy
I have found two more issues with widget:type=grid, one of which seems to be a somewhat serious bug. These new ones are related to file attachments.

1) I am trying to attach a file through the widget:type=grid (storing files on disk and not to database). Even though all other fields in the sub-form appear to be saved, the file does not appear to be saved to disk nor the filename populated in the database.

2) Due to (1), I can only upload files directly with a separate form, not with widget:type=grid. After I upload a file successfully, and then return to the grid sub-form, it does not show that a file has been uploaded. It looks like no file has been uploaded.

Steve - if you point me to the proper files, I can try to debug this (and possibly the previous issues) myself. Thanks!

Re: Two issues with widget:type=grid

PostPosted: Thu Oct 21, 2010 9:39 am
by shannah
OK.. there are a few issues here.

1. The grid widget should allow you to dynamically delete if you have permission to. I beleve you would need the "delete related record" permission.
2. File uploads currently don't work via the grid widget. It has been on the todo list for some time.

3. For fixing the "0" value in a row issue it isn't all that easy because some applications depend on this behavior. For example, I have an application where I need to be able to insert blank rows. If we just skip blank rows, it would break in this case. The reason why you're getting a "0" is likely because it is saving a "blank" value for that field and mysql is converting it to an integer since it is an INT column.