Quantcast
Channel: Krajee Yii2 Extensions – Krajee Web Tips
Viewing all 129 articles
Browse latest View live

Yii2 Kartik Grid – how to set up Editable Column in Expand Row Column child Grid

$
0
0

Hi Kartik,
I’ve got a grid with an expand row column which is ajax loading a child grid via detailUrl which calls an action that uses renderAjax. I want to have editable columns in that child grid.
 
Is it possible to get that functionality working somehow? The javascript must not be loading correctly even using renderAjax so the editable column click doesn’t do anything.
Thanks for any help!
 
Cheers,

The post Yii2 Kartik Grid – how to set up Editable Column in Expand Row Column child Grid appeared first on Krajee Web Tips.


First row of "kartik\grid\ExpandRowColumn" isn't expanded by default (GridView::ROW_EXPANDED)

Is this forum dead?

$
0
0

Is this forum dead?  I see one response to a question posted a year ago.  Lots of views but no recent answers whatsoever.  Should we be looking someplace else?

The post Is this forum dead? appeared first on Krajee Web Tips.

file input widget

$
0
0

I got an issue while uploading files. Uploaded file size is showing as zero size after validation fails . Can you help me with a solution..

The post file input widget appeared first on Krajee Web Tips.

Grid export, convert html::a to text

$
0
0

Is there a simple way to convert a html a link into normal text when exporting ? More generaly is there a way to configure for each column a different rendering value for export than the one showing in grid ?

The post Grid export, convert html::a to text appeared first on Krajee Web Tips.

yii2 mpdf on distributed file system and with loadbalancer, giving error "Unable to create output file: /path_to_file"

$
0
0

Hi, 
on our staging server with single node and no load-balancer, it is working flawless. but on production environment having distributed nodes and load-balancer, we are getting the error while creating pdf stating
“Unable to create output file: /var/www/path_to_file”

  • the file path we are providing is absolute path, as searched and accepted answers on StackOverflow.
  • folder permissions are 777

not able to understand the issue. can suggest any help?

The post yii2 mpdf on distributed file system and with loadbalancer, giving error "Unable to create output file: /path_to_file" appeared first on Krajee Web Tips.

Image not export to excel format in GridView

How to get current page number in setFooter method mPDF


Page Summary on Group totals

$
0
0

Hi Kartik
Is it possible to have a page summary as a total of grouped columns?
I’m running a report on order-items, which is grouped by order number.  I hold a donation at the order level, so the order total adds in the donation.
At the bottom of the report, I want the summary to show a total of the order totals (which include the donations)
code for grouping is:

'group' => (!empty($params['financialReport']['showDonations'])) ? true : false,
'groupFooter'=>function ($model, $key, $index, $widget) { // Closure method
return [
'mergeColumns'=>[[3,10]], // columns to merge in summary
'content'=>[ // content to show in each summary cell
2=>'Total Paid',
3=> $model->customer_last_name . ", " . $model->customer_first_name,
13=>Yii::$app->formatter->asCurrency($model->activityOrder->cartTotalPaid)
],
'contentFormats'=>[ // content reformatting for each summary cell
12=>['format'=>'currency', 'decimals'=>2],
],
'contentOptions'=>[ // content html attributes for each summary cell
1=>['style'=>'font-variant:small-caps'],
12=>['style'=>'text-align:right'],
],
// html attributes for group summary row
'options'=>['class'=>'danger','style'=>'font-weight:bold;']
];
}

Thanks
Chris

 

The post Page Summary on Group totals appeared first on Krajee Web Tips.

DetailView in Modal clicked from GridView

Detail view in modal when view action is clicked from grid with editable column.

Yii2/Kartik V FileInput MP3 fails validation in Chrome/Chromium

$
0
0

Hello,
I’m using boostrap-fileinput with Yii2 and have a form where MP3 upload should be permitted.  I’ve added the file upload field like this:
 

<?php
echo $form->field($model, 'file_name')->widget(FileInput::classname(), [
'pluginOptions' => [
'allowedFileExtensions' => ['jpg', 'gif', 'png', 'pdf', 'mp3', 'mp4', 'mov'],
'allowedFileTypes' => ['image', 'text', 'audio', 'video', 'object']
]
]);
?>

This works fine in Firefox, however, in Google Chrome, Google Chrome Mobile and Chromium the user receives an error on the validation:

Only files with these MIME types are allowed: image/jpeg, image/gif, image/png, application/pdf, audio/mpeg.

I can’t work out why I’m seeing this behaviour, although research has shown Chrome uses audio/mp3 as the mime type.  I tried adding that to allowedFileTypes but to no avail.
Any assistance would be appreciated,
 
Jonathan

The post Yii2/Kartik V FileInput MP3 fails validation in Chrome/Chromium appeared first on Krajee Web Tips.

Kartik grid action buttons not working?

$
0
0

My Solution: Remove ‘urlCreator’ => function($action, $model, $key, $index) from sample code found under README which I was using as a template. This property does not belong to the Kartik grid properties but to the grid/actionbutton. 
http://www.yiiframework.com/doc-2.0/guide-output-data-widgets.html#action-column
 

The post Kartik grid action buttons not working? appeared first on Krajee Web Tips.

Gridview sorting not working inside modal after it is closed and reopened.

$
0
0

Open a gridview inside a modal
2.Test the sorting
3.Close the modal
4.Reopen the modal and test again
 
When I follow those steps, I see…
If I have a Gridview inside a modal, the sorting works perfectly if is the first time the modal is opened. But if I close the modal and reopen it, without reloading the page, the sorting stops working. All the Ajax calls are made correctly and the responses are correct, but the grid is not updated. If I reload the page it starts to work normally again, until I close and reopen it. Attached is a screenshot showing the Ajax response, but the grid not updated.

The post Gridview sorting not working inside modal after it is closed and reopened. appeared first on Krajee Web Tips.

Gridview sorting not working inside modal after it is closed and reopened.

$
0
0

Open a gridview inside a modal
2.Test the sorting
3.Close the modal
4.Reopen the modal and test again
 
When I follow those steps, I see…
If I have a Gridview inside a modal, the sorting works perfectly if is the first time the modal is opened. But if I close the modal and reopen it, without reloading the page, the sorting stops working. All the Ajax calls are made correctly and the responses are correct, but the grid is not updated. If I reload the page it starts to work normally again, until I close and reopen it. Attached is a screenshot showing the Ajax response, but the grid not updated.

The post Gridview sorting not working inside modal after it is closed and reopened. appeared first on Krajee Web Tips.


export-columns-order

$
0
0

Hi, I would like the export file (expecially XLS) generated by Yii2-export to mimic gridview by exporting all columns in order selected in gridview configuration popup menu.
I mean, lets have two columns A and B. In gridview configuration menu (Little wrench icon) I set that B comes first. My dynagrid output looks like following:

B title| A title
-------|---------
B data | A data
 
However the export completely ignores this setting and outputs A as first column (because it is defined first in columns array passed as configuration): 


A title  | B title
---------|----------
A data | B data


In DB, I have table tbl_dynagrid which should contain configuration of gridview. I found corresponding record with id gridview<pagename>_<userid>.
But the content of data column is not changing with reordering columns via gridview configuration.
Is there way how to load (preferably by PHP itself, without JS) order of columns and export to XLS file with that order in mind?

Thank you for help.

The post export-columns-order appeared first on Krajee Web Tips.

Getting the current system time automatically

$
0
0

In my crud there’s a form that you need to input a specific time, I’m currently using the widget-datetimepicker. However is it possible if I just go to the form then it will automatically get the current system time on the computer and display it on the form?

The post Getting the current system time automatically appeared first on Krajee Web Tips.

Form Builder sub-attributes options not working

$
0
0

Hi Kartik
I have a form with sub-attributes and want to create an input container or container around those sub-attributes but it doesn’t work.

      'expiry_date' => [
                'label' => 'Expiry Date',
               'columnOptions' => ['colspan' => 2],
                // try container
                'container' => ['class' => 'input-group'],
                // try adding class to existing container
              'options' => ['class'=>'input-group'],
              // try adding input container
              'inputContainer' => 'form-groupx',
                'attributes' => [
                    'cc_expiry_date_mm' => [ ... ],
                      'cc_expiry_date_yy' => [ ... ]
                ]
              ]

 
this creates HTML as follows:-





Expiry Date





Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec


</div>
</div>



2015
2016
2017
2018
2019
2020
2021
2022
2023



</div>
</div>
</div>
</div>
</div>
</div>

Thanks
Chris

The post Form Builder sub-attributes options not working appeared first on Krajee Web Tips.

Form Builder sub-attributes options not working

$
0
0

Hi Kartik
I have a form with sub-attributes and want to create an input container or container around those sub-attributes but it doesn’t work.

      'expiry_date' => [
                'label' => 'Expiry Date',
               'columnOptions' => ['colspan' => 2],
                // try container
                'container' => ['class' => 'input-group'],
                // try adding class to existing container
              'options' => ['class'=>'input-group'],
              // try adding input container
              'inputContainer' => 'form-groupx',
                'attributes' => [
                    'cc_expiry_date_mm' => [ ... ],
                      'cc_expiry_date_yy' => [ ... ]
                ]
              ]

this creates HTML as follows:-





Expiry Date





Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec


</div>
</div>



2015
2016
2017
2018
2019
2020
2021
2022
2023



</div>
</div>
</div>
</div>
</div>
</div>

The post Form Builder sub-attributes options not working appeared first on Krajee Web Tips.

Form Builder sub-attributes options not working

$
0
0

Hi Kartik
I have a form with sub-attributes and want to create an input container or container around those sub-attributes but it doesn’t work.

      'expiry_date' => [
                'label' => 'Expiry Date',
               'columnOptions' => ['colspan' => 2],
                // try container
                'container' => ['class' => 'input-group'],
                // try adding class to existing container
              'options' => ['class'=>'input-group'],
              // try adding input container
              'inputContainer' => 'form-groupx',
                'attributes' => [
                    'cc_expiry_date_mm' => [ ... ],
                      'cc_expiry_date_yy' => [ ... ]
                ]
              ]

this creates HTML as follows:-


// no container div form-groupx

//no options class input-group2 or container class input-group1 in above div
Expiry Date





Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec


</div>
</div>



2015
2016
2017
2018
2019
2020
2021
2022
2023



</div>
</div>
</div>
</div>
</div>
</div>

The post Form Builder sub-attributes options not working appeared first on Krajee Web Tips.

Viewing all 129 articles
Browse latest View live