Page 1 of 1
Grid: Cannot add existing record / disable editing entries
Posted:
Thu Mar 25, 2010 7:14 am
by hanstest
Hi
I like the grid widget to handle relationships between tables. It seems better in some cases. However, I have found two things I cannot get around:
- in one case I want only to add existing records. However, pressing the "Add exising" button below the grid lines has no effect. Nothing happens when pressed. Adding existing entries via the conventional way works very well. I guess it is not a permission issue, as I have ADMIN permissions.
-Is it possible to disable editing of the entries in the grid: I have two fields in the grid e.g. "title" and "position", where "title" is linked to the related record. However, I don't want to allow users to change the title here. If the change the entry and press "Save" the title of the related record is changed.
Thank you for your help
Mika
Re: Grid: Cannot add existing record / disable editing entries
Posted:
Thu Mar 25, 2010 7:58 am
by shannah
You could set up a relationship only to the "join" table. Then use widget:columns directive to only show the "id" field. And make sure the "id" field is either a select list or a lookup. This would result in a one-column grid where each row is either a lookup or a select list selecting the record that you want to be related.
You would want to set this relationship not to show up in your related tabs also. You can do this by adding the
action:condition=0
directive to the relationship definition in relationships.ini
Re: Grid: Cannot add existing record / disable editing entries
Posted:
Fri Mar 26, 2010 4:35 am
by hanstest
Thank you that did the job, at least partly.
Before I used the "vocabulary:existing" directive to restrict the entries to add from a set of available records. When I use the select widget this seems not so easy. If I restrict the select sql query by a condition "where Active=1" this works fine - only the wanted entries show up in the select widget to add entries. However, If the "Active" status of a already added record changes to "0" then the select widget of this record doesn't show the correct value (only "Please select.").
Is there any easy way around this? Other than using a block function to define the select widget.
Mika
Re: Grid: Cannot add existing record / disable editing entries
Posted:
Fri Mar 26, 2010 5:14 pm
by shannah
What version of Xataface are you using? I seem to recall fixing this issue.
Re: Grid: Cannot add existing record / disable editing entries
Posted:
Sun Mar 28, 2010 10:16 pm
by hanstest
Version.txt says 1.2.3b2 1700
I managed to create my own function to create a "select" widget in some other case.
However, I fail to apply a function when a table is in a relationship and values are entered via a grid. The function seems to be ignored.
Re: Grid: Cannot add existing record / disable editing entries
Posted:
Mon Mar 29, 2010 10:32 am
by shannah
I sense this is a bug. Can you post a minimal test case that would reproduce this problem (i.e. minimal table def, fields.ini, valuelists, relationships to reproduce).
-Steve
Re: Grid: Cannot add existing record / disable editing entries
Posted:
Wed Mar 31, 2010 3:21 am
by hanstest
shannah wrote:I sense this is a bug. Can you post a minimal test case that would reproduce this problem (i.e. minimal table def, fields.ini, valuelists, relationships to reproduce).
I have compiled an example to reproduce the cases mentioned above. There is mainly three tables: sensors, instruments and one to store the sensor/instrument relation. It has been mailed to you.
This was enough to reproduce the bug. Please contact me for more info, if necessary. I am using the latest xataface with xampp light 1.7.3 on windows.
Re: Grid: Cannot add existing record / disable editing entries
Posted:
Thu May 13, 2010 10:48 pm
by hanstest
Hi,
these two issues seem no to be corrected in 1.2.4 !? It still shows "Please select" for entry in the grid, when "Active = 0" and I cannot redefine widgets via a function, when used in a grid.
Any solution for this problems. They would be of great help to me.
Mika
Re: Grid: Cannot add existing record / disable editing entries
Posted:
Sun Sep 05, 2010 4:10 pm
by cantlep
This still seems to be the same in 1.2.5 also. Certainly the "Add existing" button still does not seem to do anything.
Minimal files:
fields.ini
- Code: Select all
[SiteName]
widget:label = "Site Names"
transient=1
widget:type = grid
relationship=SiteData
widget:columns="SiteName"
relationships.ini
- Code: Select all
[SiteData]
SiteData_ContractData.SiteName=SiteData.SiteName
SiteData_ContractData.ContractDataID="$ContractDataID"
Also, for some reason, even though I have "widget:columns=SiteName" specified, it actually doesn't show anything (just a blank box), it does however show other fields from the SiteData table if I remove the reference completely. "CompanyName" and an ENUM field with YES or NO as possibles. Every other field is blank (even though in the table they are populated.
Another bug?
Cheers