7913 Posts in 1355 Topics by 930 members
|Go to End||Next >|
10 March 2009 at 4:59pm
UncleCheese, Have you ever thought about modifying the popup to have the save button on the bottom next to the close button? Just a random thought.
11 March 2009 at 2:53am
Good idea, but unfortunately, not likely to happen. The save button needs to be in the iframe and the close button needs to be on the popup window itself. The next enhancement I make to the FileDataObjectManager, and by transference, the ImageGallery, is to add a "Stop Captioning" button next to save that will give the users a more intuitive way to stop the post-upload walkthrough if they wish.
14 March 2009 at 5:18pm
Uncle Cheese, Noticed that a boolean displays in the table as a 1 or 0. Could this be a checkbox instead? Possibly even editable from the table view?
14 March 2009 at 6:44pm
That's true with any TableField. Make sure you build a custom getter.
static $db = array (
'MyBool' => 'Boolean'
public function getMyBool()
return $this->MyBool ? "Yes" : "No";
14 March 2009 at 7:03pm Last edited: 14 March 2009 7:10pm
Thanks, Actually I was already trying something like this:
public function getPublish()
$field = new CheckboxField('Publish','Publish this content?',$this); [EDIT]
But it only displays the checkbox, it doesn't accept the changes...
14 March 2009 at 8:25pm Last edited: 14 March 2009 8:27pm
ok, well I got it to work, learned that you can't use $this->MyBoolean inside a getMyBoolean, had to change function to getMyBooleanField.
Now that seems to work for viewing, but the edits don't persist. Any Ideas?
15 March 2009 at 5:04am
You're not understanding how a custom getter works.
$manager = new DataObjectManager(
array('Title' => 'Title, 'Published' => 'Published')
class MyDataObject extends DataObject
static $db = array (
'Title' => 'Varchar(100)',
'Published' => 'Boolean'
public function getPublished()
return $this->Published ? "Published" : "Unpublished";
That's all you need. When drawing the values for each record, SS first looks for a function named get[PropertyName]. If that function exists, it returns the value of that function. Otherwise, it just returns the value of PropertyName, which in the case of a boolean, is a 1 or 0.
15 March 2009 at 5:29am
I appreciate your comments, however I do understand how the get functions work. Your code will not work, you get an error. $this->Published is undefined, by asking in the IRC channel I found out that it was because that basically creates infinite recursion. You are calling the get function you just defined within it's self by asking for $this->Published. So I had to write a differently named getter to get the field I wanted, I want an ACTUAL check box field so I need to return a field. Well my code achieves this portion of my question. The open question I have is it possible to directly edit the data from the table and not within the light box? I have a checkbox, and I can change it's state from the table, but the changes do not persist. On a similar note, what if you wanted the text to be editable from the table, is this possible?
Again, I appreciate your help! Thanks again!
|Go to Top||Next >|