Grid: Cannot add existing record / disable editing entries

A place for users and developers of the Xataface to discuss and receive support.

Grid: Cannot add existing record / disable editing entries

Postby hanstest » Thu Mar 25, 2010 7:14 am

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
hanstest
 
Posts: 5
Joined: Thu Mar 25, 2010 7:02 am

Re: Grid: Cannot add existing record / disable editing entries

Postby shannah » Thu Mar 25, 2010 7:58 am

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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Grid: Cannot add existing record / disable editing entries

Postby hanstest » Fri Mar 26, 2010 4:35 am

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
hanstest
 
Posts: 5
Joined: Thu Mar 25, 2010 7:02 am

Re: Grid: Cannot add existing record / disable editing entries

Postby shannah » Fri Mar 26, 2010 5:14 pm

What version of Xataface are you using? I seem to recall fixing this issue.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Grid: Cannot add existing record / disable editing entries

Postby hanstest » Sun Mar 28, 2010 10:16 pm

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.
hanstest
 
Posts: 5
Joined: Thu Mar 25, 2010 7:02 am

Re: Grid: Cannot add existing record / disable editing entries

Postby shannah » Mon Mar 29, 2010 10:32 am

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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Grid: Cannot add existing record / disable editing entries

Postby hanstest » Wed Mar 31, 2010 3:21 am

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.
hanstest
 
Posts: 5
Joined: Thu Mar 25, 2010 7:02 am

Re: Grid: Cannot add existing record / disable editing entries

Postby hanstest » Thu May 13, 2010 10:48 pm

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
hanstest
 
Posts: 5
Joined: Thu Mar 25, 2010 7:02 am

Re: Grid: Cannot add existing record / disable editing entries

Postby cantlep » Sun Sep 05, 2010 4:10 pm

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
cantlep
 
Posts: 172
Joined: Fri Mar 05, 2010 2:14 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 22 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved