sorting fieldgroup by drag and drop
Archived from the Xataface Users forum.
kevinwen — Mon Jul 19, 2010 2:31 pm
I’m having a problem remembering the order of sections on the preference of a user. When a user drag and drop the section (fieldgroups) in the view tab, the sections is re-ordered. However, when user comes back on the view tab, the original order shows. the system can’t keep the order the user made.
I found a ajax_sort_sections.php under xataface/actions folder and it does the thing I want (remember the new order of sections). How do I turn on this feature so an ajax call is fired off when a user drag and drop sections?
shannah — Tue Jul 20, 2010 10:13 am
It is supposed to be on by default. Is any javascript error showing when you sort the sections?
kevinwen — Mon Jul 26, 2010 11:07 am
Hi, Steve
I don’t see any javascript error in Firebug. Is there any other tool I can use to capture the error?
kevinwen — Mon Aug 02, 2010 8:33 pm
Steve,
Do you have a sample application you wrote that works for the drag-and-drop? I want to try it out if you do have one, so I can figure out what goes wrong in my application. Thanks.
kevinwen — Mon Aug 02, 2010 8:34 pm
Steve,
Do you have a sample application you wrote that works for the drag-and-drop? I want to try it out if you do have one, so I can figure out what goes wrong in my application. Thanks.
shannah — Wed Aug 11, 2010 10:05 am
I’ve noticed a bug that causes the sorting not to save on the first attempt. But all subsequent attempts work fine. Do you confirm this behavior, or does it fail on all attempts.
-Steve
kevinwen — Wed Aug 11, 2010 4:49 pm
It fails on all attempts. Thanks for taking time to improve the framework.
shannah — Wed Aug 11, 2010 4:58 pm
Can you give me a link to your app to try it. I can’t reproduce that behavior.
kevinwen — Tue Aug 17, 2010 5:17 pm
Hi, Steve
This is the internal tool and has no access outside. I can give you the sample app I downloaded from your website and see if that would help:
conf.ini:
- Code: Select all
- `title=”profiles_demo”
[_database]
host = “localhost”
user = “db_user”
password = “db_password”
name = “profiles_demo”[_tables]
people = “People”
posts = “Posts”
people_categories = “Categories”[_prefs]
;disable_ajax_record_details=0`
tables/people/fields.ini:
- Code: Select all
- `[fieldgroup:surname]
label=”Surname”
order = 1
section:order = 1[fieldgroup:givename]
label=”Given Name”
order = 2
section:order = 2[first_name]
widget:label = “Given Name”
widget:description = “Please enter your first name”
validators:required = 1
validators:required:message = “Please enter your given name”
group = givename
[last_name]
widget:label = “Surname”
widget:description = “Please enter your last name”
validators:required = 1
validators:required:message = “Please enter your surname”
group = surname
[bio]
widget:type=htmlarea
[category]
widget:type=select
vocabulary=categories`
tables/people/valuelists.ini:
- Code: Select all
[categories] __sql__ = "select user_entry_id, user_name from users order by user_name" ;1=Mail men ;2=politicians ;3=Tech guys
tables/people/relationships.ini:
- Code: Select all
[posts] posts.owner_id = "$person_id"
tables/posts/fields.ini:
- Code: Select all
- `[body]
widget:type=htmlarea[owner_id]
widget:label = “Poster”
widget:type=select
vocabulary=owners`
tables/posts/valuelists.ini:
- Code: Select all
[owners] __sql__ = "select posts.owner_id, CONCAT(people.first_name, ' ', people.last_name) as owner from posts, people where posts.owner_id = people.person_id"
tables/posts/relationships.ini:
- Code: Select all
[people] people.person_id = "$owner_id"
The database structures look like the following:
- Code: Select all
- `` CREATE TABLE IF NOT EXISTS
people(
person_idint(10) NOT NULL AUTO_INCREMENT,
first_namevarchar(64) NOT NULL,
last_namevarchar(64) NOT NULL,
biotext NOT NULL,
categoryint(10) NOT NULL,
PRIMARY KEY (person_id)
);CREATE TABLE IF NOT EXISTS
posts(
post_idint(10) NOT NULL AUTO_INCREMENT,
bodytext NOT NULL,
owner_idint(10) NOT NULL,
PRIMARY KEY (post_id)
);CREATE TABLE IF NOT EXISTS
people_categories(
idint(10) NOT NULL AUTO_INCREMENT,
namevarchar(64) NOT NULL,
PRIMARY KEY (id)
); ``
The attached is the screenshot for the view of the entry in people table.
kevinwen — Tue Aug 31, 2010 10:20 am
Hi, Steve
Is there any update? Thanks.