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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Model Admin display bug?


Go to End


9 Posts   4218 Views

Avatar
webtonic

Community Member, 26 Posts

28 October 2010 at 7:02pm

Hi Guys

I have tried to extend ModelAdmin and all seems ok until I click in the search option and the ctf looks like it is not loading its style sheet (image attached). I am running 2.4 and has tried this on 3 different servers and had the same result. Al with fresh installs.

if you have any ideas I would appreciate it. The weird thing is on the wamp server on my pc it is perfect!

thanks Craig

Avatar
cuSSter

Community Member, 56 Posts

3 November 2010 at 1:39am

Is this on the live site?

Avatar
webtonic

Community Member, 26 Posts

3 November 2010 at 6:45am

Yes this is on the live site

Avatar
cuSSter

Community Member, 56 Posts

3 November 2010 at 7:27pm

Can you post the class that you have created?

Avatar
webtonic

Community Member, 26 Posts

3 November 2010 at 7:39pm

Edited: 03/11/2010 7:41pm

3 files

VehicleAdmim.php

<?php
class VehicleAdmin extends ModelAdmin{
static $managed_models = array ('Vehicle');

static $url_segment = "trucks";
static $menu_title = "Trucks";

}
?>
Vechicle.php

<?php
class Vehicle extends DataObject
{
static $db = array(
"Stockcode"=>"Varchar(64)",
"Category"=>"Enum('Truck,Trailer','Truck')",
"Type"=>"Varchar(64)",
"Make"=>"Varchar(64)",
"Model"=>"Varchar(64)",
"Year"=>"Int",
"Colour"=>"Varchar(32)",
"Vin"=>"Varchar(64)",
"Engine"=>"Varchar(64)",
"Horsepower"=>"Int",
"Transmission"=>"Varchar(64)",
"Wheelbase"=>"Varchar(64)",
"Speedo"=>"Varchar(32)",
"Tare"=>"Varchar(32)",
"Gvwrating"=>"Varchar(64)",
"Gcwrating"=>"Varchar(64)",
"Regnum"=>"Varchar(64)",
"Regexpiry"=>"Varchar(64)",
"Additional"=>"Varchar(255)",
"Price"=>"Currency",
"Cofexpiry"=>"Varchar(64)",
"Axelconfig"=>"Varchar(64)",
"Rearaxels"=>"Varchar(64)",
"Suspension"=>"Varchar(64)",
"Towingeye"=>"Varchar(64)",
"Hubometer"=>"Varchar(64)",
"Roaduserkms"=>"Varchar(64)",
"Deck"=>"Varchar(64)",
"Drawbeamcert"=>"Varchar(64)",
"Chassismod"=>"Varchar(64)",
"Anchorage"=>"Varchar(64)",
"Nzhbc"=>"Varchar(64)",
"Kingpincert"=>"Varchar(64)",
"Fifthwheel"=>"Varchar(64)",
"Twistlocks"=>"Varchar(32)",
"Tyreinfo"=>"Varchar(64)",
"Tyrefront1"=>"Varchar(32)",
"Tyrefront2"=>"Varchar(32)",
"Tyrefront3"=>"Varchar(32)",
"Tyrefront4"=>"Varchar(32)",
"Tyrerear1"=>"Varchar(32)",
"Tyrerear2"=>"Varchar(32)",
"Tyrerear3"=>"Varchar(32)",
"Tyrerear4"=>"Varchar(32)",
"Condition"=>"Enum('New,Used','New')",
"Description"=>"Varchar(127)",
);

static $field_labels = array(
"StockCode"=>"Stock Code",
"Vin"=>"Vin Number",
"Engine"=>"Engine Type",
"Horsepower"=>"Engine Horsepower",
"Speedo"=>"Speedo Reading",
"Tare"=>"Tare Weight",
"Gvwrating"=>"GVW Rating",
"Gcwrating"=>"GCW Rating",
"Regnum"=>"Registration Number",
"Regexpiry"=>"Registration Expiry",
"Additional"=>"Addition Information",
"Cofexpiry"=>"COF Expiry",
"Axelconfig"=>"Axel Configuration",
"Rearaxels"=>"Rear Axels",
"Suspension"=>"Rear Suspension",
"Towingeye"=>"Towing Eye Size",
"Roaduserkms"=>"Road User Kms",
"Deck"=>"Deck Type & Length",
"Drawbeamcert"=>"Drawbeam Cert Expiry",
"Chassismod"=>"Chassis Mod Expiry",
"Anchorage"=>"Load Anchorge Expiry",
"Nzhbc"=>"NZHBC Compliance",
"Kingpincert"=>"Kingpin Cert Expiry",
"Fifthwheel"=>"5th Wheel Mount Cert",
"Twistlocks"=>"Twist Locks Fitted/Cert",
"Tyreinfo"=>"Tyre Information",
"Tyrefront1"=>"Front 1",
"Tyrefront2"=>"Front 2",
"Tyrefront3"=>"Front 3",
"Tyrefront4"=>"Front 4",
"Tyrerear1"=>"Rear 1",
"Tyrerear2"=>"Rear 2",
"Tyrerear3"=>"Rear 3",
"Tyrerear4"=>"Rear 4"
);

static $has_one = array();

static $has_many = array (
'Photos' => 'Photo'
);
public function getCMSFields()
{

$f = parent::getCMSFields();
$manager = new ImageDataObjectManager(
$this, // Controller
'Photos', // Source name
'Photo', // Source class
'PhotoPic', // File name on DataObject
array(
'PhotoHeading' => 'Photo Heading',
'PhotoText' => 'Photo Copy'
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)

// Filter clause '`GalleryPageID` = '.$this->ID.''
// Sort clause
// Join clause
);

$manager->setAddTitle("Image");
//$f->addFieldToTab("Root.Content",$manager);
return $f;
}

static $searchable_fields = array("Stockcode","Make","Model","Type");
static $summary_fields = array("Stockcode","Make","Model","Type");
}
Photo,php

<?php

class Photo extends DataObject{
static $db = array(
'PhotoHeading' =>'Text',
'PhotoText' =>'Text'
);
static $has_one = array(
'PhotoPic' => 'Image',
'Vehicle' => 'Vehicle'
);

}
?>

Avatar
swaiba

Forum Moderator, 1899 Posts

3 November 2010 at 10:37pm

Hi,

A couple of notes...

1) an empty has_one is not required (only specify what you need)
2) in the case of summary_fields being the same as searchable_fields - you only need summary_fields
3) I'd remove almost all the code, dev/build, view, add items back in one by one to fix this

I cannot see the error right off, but I have had strange results from ModelAdmin and it can be a pain to find out what it was, but starting with a clean install and the smallest code and working up gets it working in the end?

Avatar
cuSSter

Community Member, 56 Posts

4 November 2010 at 1:52am

Hi,

Try adding the following lines of codes to your VehicleAdmin.

public static $url_rule = '$Action/$ID';

public static $model_importers = null;

public function getModelImporters() {
return null;
}

Then hit me back with the result.

Avatar
webtonic

Community Member, 26 Posts

4 November 2010 at 6:50am

Hi Pinoy

No change at all in the results.

thanks
Craig

Go to Top