Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

complex table field strange behavior when checking/unchecking items


Reply


5 Posts   1252 Views

Avatar
Carbon Crayon

Community Member, 598 Posts

5 February 2009 at 11:25am

I have recently been noticing very strange behavior is some of my CTF when checking and unchecking objects in them.

They will only save as checked the items which are changed, and will uncheck any other items, even if they are still checked when saving. So in other words if I had 5 items and the first 3 were checked, in order to get all 5 checked after saving, I would have to uncheck the first 3 and check the last 2!

Thats probably pretty confusing! So here is a couple of examples:

Example 1
Open page:
Item1: Checked
Item2: Checked

Change to:
Item1: Checked
Item2: UnChecked

Save page and reload becomes:
Item1: UnChecked
Item2: Checked

Example 2
Open page:
Item1: Checked
Item2: Checked
Item3: UnChecked
Item4: UnChecked

Change to:
Item1: UnChecked
Item2: UnChecked
Item3: Checked
Item4: Checked

Save page and reload:
Item1: Checked
Item2: Checked
Item3: Checked
Item4: Checked

Its pretty mind boggling before you know whats going on and even then its a real pain, especially if your table is filtered so to only show items accociated with that page, one wrong click and you can lose the whole lot, with the only way to get them back being to edit the database.

I have had this problem with a number of installs both on my local windows env and on my live linux server all using 2.23.

has anyone else seen this behavior?

Avatar
SilverRay

Community Member, 167 Posts

5 February 2009 at 8:35pm

Yes, I see this behavior sometimes (also with 2.3 RC2). I don't have a solution, really, other than reloading the cms with ?flush=1. That sometimes helps. I posted about this problem earlier as well (and talked about it during IRC chat hours) but that didn't get anywhere either...

Avatar
Fuzz10

Community Member, 787 Posts

5 February 2009 at 11:32pm

Did not bump into this myself, but eeh...

This sounds like a pretty huge issue , no ?

Did you create a ticket ?

Avatar
Carbon Crayon

Community Member, 598 Posts

5 February 2009 at 11:39pm

Yea it does seem like a pretty major bug, just wanted to check it wasn't just me before I made a ticket :)

Avatar
Carbon Crayon

Community Member, 598 Posts

6 February 2009 at 12:52pm

Edited: 06/02/2009 12:53pm

ok thanks to ajshort for pointing me to this ticket with a solution: http://open.silverstripe.com/ticket/2723

Open sapphire/javascript/RelationComplexTableField.js

and move these two declarations at the top of the page:

var checkedListNameArray = null;
var checkedArray = null;

to inside the function like this:

RelationComplexTableField = Class.create();
RelationComplexTableField.prototype = {

   initialize: function() {
      
      var checkedListNameArray = null;
      var checkedArray = null;

Not sure why they wouldn't have added this to 2.3, but anyway is simple enough change :)