I have installed YiiBooster and am using the latest Yii v1.1.13. My main.php file contains the following configuration:
'preload'=>array('log','bootstrap'),
// application components
'components'=>array(
'bootstrap'=>array(
'class'=>'ext.bootstrap.components.Bootstrap',
'responsiveCss'=>true,
),
'user'=>array(
'class'=>'RWebUser',
// enable cookie-based authentication
'allowAutoLogin'=>true,
'loginUrl'=> array('/user/login'),
),
...
However, after doing this none, of the YiiBooster widgets are displaying properly. As a new user I am not able to post images; however, my datepickerRow() widget looks just like the one in this post: Yii Booster datepicker not working correctly. The 'look' of the widget is not normal.
I have a number of other problems with other widgets. The bigger problem is the TbExtendedGridView that is not showing any of the View/Edit/Delete icons. Actually none of my 'prepend' icons are working on the forms either. Any ideas?
As requested - here is an example of a widget not working correctly. None of the little icons for view/edit/delete are shown. Also the row striping is not working, and the column title bar is a strange color.
$this->widget('bootstrap.widgets.TbExtendedGridView', array(
'dataProvider'=>$dataProvider,
'type'=>'striped',
'columns'=>array(
'Registration',
'WONumber',
'InspectionType',
'LogEntryDate',
),
));
I am also having trouble with a textfieldRow() control. So I don't believe this is a problem with widgets, I think it is something to do with the way I have YiiBooster configured.
UPDATE - Still Not Working
I have found that the file in conflict with the CSS is the /var/www/intranet/css/screen.css file. When I remove this file from my main.php layout file, the CSS from YiiBooster works properly. The problem is that the rest of the page looks terrible.
So, I'm still researching why I can't run blueprint CSS and YiiBooster at the same time. Any help would be appreciated.
UPDATE - SOLVED
I found that other people were having trouble running the stock Yii blueprint CSS setup, so I switched completely over to YiiBooster and have not had any problems. I removed the CSS links in my main.php layout file. After converting all of the Yii widgets to YiiBooster widgets, everything works great.
You need to add the following to your grid as an element of the columns array:
array(
'class'=>'bootstrap.widgets.TbButtonColumn',
'htmlOptions'=>array('style'=>'width: 50px'),
),
Related
I'm building website using asp.net core 3.1 following tutorials, I'm working on bootstrap template, now I encountered strange problem that when I pass a strongly typed model to the view the layout of bootstrap not working, but if request the view without sending model it work...
Searching in google doesn't give a result.
Please enter the script and css with the view rendersection you are using and add the bootsrap links there
#Rendersection("Scripts",false) and #Rendersection("Style" ,false) include in layout after go to view add up #section Style ( bootsrap css link ) and down view add section script
I figured out what was the problem, It's was in svg-icons calls, it was starts with "~/svg-icons/" so I replaced it with "../svg-icons/", so the problem solved.
I am new to Yii, I am trying to get a CListView to update using ajax instead of refreshing the page. To make the simplest example, I am just feeding the CListView with a dataprovider and giving it the itemView parameter, nothing else. I want the pagination to update the page without refreshing. It works with gii generated crud pages but will not work with mine. I have added nothing extra, the code for the gii generated example and my own should be the same. Is there some setup step I am missing? Is there javascript missing in my layout that the default layout has perhaps? Thank you in advance.
It turns out that I was loading jQuery in my layout which was interfering with the jQuery library automatically loaded in Yii. Simply removing my jQuery include solved the problem. I will chalk this one up to being new at Yii and not knowing the inner workings of how it automatically includes javascript. Thanks guys, Rajat you put my mind on the right track, thanks.
if append to page the CGridView ('myGridViewID') by ajax, I can't reload it.
$.fn.yiiGridView.update('myGridViewID');
TypeError: settings is undefined
$grid.addClass(settings.loadingClass);
Use renderPartial in controller action:
$cs = Yii::app()->clientScript;
$cs->reset();
$cs->scriptMap = array(
'jquery.js' => false, // prevent produce jquery.js in additional javascript data
);
// Look at 4th parameter: with TRUE value, your view will have additional javascript data.
$this->renderPartial('_partialViewWithGrid', array(), false, true);
Here is a wiki for dynamic CgridViews in the same view. That should work.
The problem with dynamically loaded CGridViews (and everything containing ajax) is that CController::renderPartial() does not render the required javascript code for them to work properly, unlike CController::render(), which includes the required layout and JS.
There is an extension called ZController which offers a workaround for this problem, but due to the way CGridviews are reloaded (by making an ajax call to the same URL)... when you try to filter/sort/page a CGridView loaded via AJAX, the subsequent Ajax call will replace the whole contents of your browser window, but I honestly think that maybe (only maybe) this workaround could help, but I haven't had the time to try it out.
That is why I currently avoid loading CGridViews using AJAX.
I am working with Yii Jui widgets to have JuiTabs in a website. The problem is when the site is loading I first see the list (without any css) and then after the page loads the tabs show as they should. I wonder if there is a way to preload JuiTabs somehow so they show correctly when the page is loading.
Here is my code:
<?php
$this->widget('zii.widgets.jui.CJuiTabs', array(
'tabs'=>array(
'PRESENTAZIONE'=>array('content'=>$this->renderPartial('spettacoli/_view_presentazione', array('model'=>$model),$this)),
...
),
'options'=>array(
'collapsible'=>false,
),
));
?>
And here is the example of the page. The problem is visible when the internet connection is slow, and it takes time until the page loads
Not sure that's possible to preload JuiTabs somehow, but you can add display: none for CJuiTabs by default and show that with JS on page load. Not the best way, but first idea came into my mind.
I have followed the instructions found on the Guides for building a custom layout:
NOTE: The portfolio is an engine of my own, not the refinerycms-portfolio.
config.layout_template_whitelist = ["application","portfolio"]
config.use_layout_templates = true
Created a portfolio.html.erb under app/views/layouts and copied everything from the application.html.erb except for the <header> section: I do not want the menu and logo shown in this layout, but all the rest
I can now see the layouts in the back end.
If I choose my portfolio page and press preview, the layout renders without the menu
However, if I go directly to /portfolios, the 'application' layout renders and not the 'portfolio'
Any ideas please?
Thank you...
Well, it seems that the namespacing introduced in the latest RefineryCMS versions prevents the layout to be picked up automatically, thus you need to manually instruct the Controller to pick up the layout in question. To this case I had to add:
render :layout => 'layouts/portfolio'
in my portfolios#index action.
Hope this helps...