How add CJuiDatePicker in JQRelcopy on Yii Framework - yii

I have a problem with CJuiDatePicker in the module JQRelcopy on Yii framework.
I use this module as I have a form with a datepicker field to be copied as many times as the user wishes.
The module works fine if I put a normal field (without datepicker), but as soon as I add the module CJuiDatePicker which is also a module of the Yii framework, I have a blank page appears. I followed the following tutorial: http://www.yiiframework.com/extension/jqrelcopy/ explains the integration jqrelcopy in a form containing CJuiDatePickerm, which is exactly what I need.
I study the problem and I saw that it was when I Atoute the following line in the properties of my widget JQRelcopy the problem occurs:
'jsAfterNewId' => JQRelcopy::afterNewIdDatePicker($datePickerConfig),
in
$this->widget('ext.jqrelcopy.JQRelcopy', array(
'id' => 'copylink',
'removeText' => 'remove',
//add the datapicker functionality to the cloned datepicker with the same options
'jsAfterNewId' => JQRelcopy::afterNewIdDatePicker($datePickerConfig),
));
I look in several forums and anywhere a person has had the same problem as me.

The only way I could do this in the past, was ditching the CJuiDatePicker and using the on method of JQuery.
$('body').on('focus', '.idata', function(){
jQuery(this).datepicker(
jQuery.extend(
{showMonthAfterYear:false},
jQuery.datepicker.regional['pt-BR'],
{'showAnim':'fold','dateFormat':'dd/mm/yy'}
)
);
});
Or, you can use live method...

Just Import ext.jqrelcopy.JQRelcopy in your form file at the top
Yii::import('ext.jqrelcopy.JQRelcopy');
Your Problem be solved if any Issue let me know i will further assist.

Related

Implementing custom search in datatables.net with angular 4

I'm trying to implement a simple custom search on a column.
This is well documented at https://datatables.net/examples/plug-ins/range_filtering.html.
However my (so far) only problem is accessing the $.fn.dataTable.ext.search array, to add and later remove my custom search function.
What is the path for this array, when going through angular-datatables?
Thanks in advance for your help.
this.datatableElement.dtInstance.then((dtInstance: DataTables.Api) => {
dtInstance. <-- what goes here?
});
Was solved by the developer at https://github.com/l-lin/angular-datatables/issues/1111
It was because the typings were not complete, when using typescript in angular.
Correct reference is $.fn['dataTable'].ext.search

drupal 8 show field twice

I created a custom bundle (content type) and I've created fields
One of those field is a file type field, is a video file, stored in the private storage. I installed the videojs module to allow to watch the video.
I need to show this field twice in the node page. One in the generic file formatter that allows the user to download the file, and I also need to play the video. I decided to set up as generic file formatter and customize the twig template to show again with the video player.
I achieve to show twice with the settings formatter (generic file) with this code in the node--mybundle--full.html.twig template
{{ content.field_sd_video }}
I thought it would be something easy like field+formatter:
{{ content.field_sd_video|videojs_formatter }}
But I can't find what is the simple way to achieve this. May be it's necesary more a tricky way ?
I finally found the solution, I put this code in preprocess node function. It has to be easy, but not easy to know how ;)
function mytheme_preprocess_node(&$variables) {
$variables['video_caption'] = $variables['node']->get('field_video')
->view(array(
'label' => 'hidden',
'type' => 'videojs_player_list'
));
}
and I only has to add this line in twig file:
{{ video_caption }}
in my case node--mybundle--full.html.twig template
For those arrive here looking for something similar
I was inspired by Twig Recipes on page 41
It was usefull for me Twig debugging. Playing with kint and node variable and the classes used to wrap the information. Then I found that the field comes with [FileFieldItemList] and then I found the view method that uses [EntityViewBuilderInterface]

Datetimepicker shows up in a 'naked' way

I want to set up both date and time in a custom field (Yii).
For this i've chosen this datetimepicker.
But as i've loaded it into protected/extentions it now works, but its outlook is somehow 'naked'. I've rounded datepicker's appearence in red.
Its configuraition is:
<?php $form->widget ('ext.CJuiDateTimePicker.CJuiDateTimePicker',
array (
'attribute'=>'start',
'model'=>$model,
'value' => $model->start,
'language' => 'en',
'options'=>array (
// 'timeFormat'=>strtolower(Yii::app()->locale->timeFormat),
'showSecond'=>true,
),
)
); ?>
How to fix it? Am i missing some skin files? How to get them?
I use bootstrap theme FYI.
This is a styling issue .
Download correct Style.css file it will show datepicker correctly .
The issue was that in the Yii app development i was using the NlsClientScript Yii Extention for preventing duplicate scripts loading. So, the datatimepicker's css file has not been loaded into the current nlsXXXXXXX.css file. It turned that this NlsClientScript does manage/aggregate the css files load, the docs saying opposite though...
From documentation:
The extension does not prevent the multiple loading of CSS files.
So I've found the corresponding file, deleted it and reloaded the app.
From documentation:
The extension doesn't watch wether a js/css file has been changed. If you set the merge functionality and some file changed, you need to delete the cached merged file manually, otherwise you'll get the old merged one.

rails 3.2 not detecting javascript changes?

i am a newbie in rails 3.2. now i have a problem following:
i have 2 patials for showing highchart are _device_per_product.html.erb and device_per_platform.html.erb. and i render these by this way:
jQuery("#element_div").html("<%= escape_javascript(render(:partial => 'partial_page')) %>");
when i click a link to render my partial,it works. but next time, i render another partial,it just load javascript code but not generate highchart form these code.
In my opinion,For First time the javascript is freshly loading in my page. So it will work. Next time my javascript is not working. please help me solve that problem
I suspect you have something like:
$('#element_div a').click(function() {
//do something
});
This only binds to what's on the page when it fires. If you are introducing new (or replacing) this then you need to change the listener.
$(document).on("click","#element_div a", function () {
// do something
}} );
A more detailed explanation along with alternatives for older versions of jquery can be found at https://stackoverflow.com/a/10394566/2197771

how to integrate hebo html template into yii framework

how to integrate hebo html template into yii framework
I am new to using yii framework.I download hebo template from
http://www.webapplicationthemes.com/hebo-responsive-html5-theme/
I can installed template hebo but i don´t work with ie.
Don´t work fluid bootstrap.
go to views/layouts/main.php and delete html comment " <- Require the header ->" instead you can add it as php comment. This comment appears before tag and it causes IE doesn´t understand HTML5.
Did you convert the theme to work with Yii?
One of the problems with this kind of theme is that it has multiple page types and this is harder to replicate in Yii. By default, Yii has no concept of page type unless you code this into the controller using layouts ....
At the very simplest level, the conversion could be based on the fullwidth page,, converting the mainContent divs to inject $content. You would then need to change a layout to use single column ...
I've just completed this for another of their templates and it doesn't take too long - though if any one has a better idea for page types I would be very interested ....