I'm working with FullExportMenu from Kartik. I have problem with styling confirm dialog.
My code:
$fullExport = FullExportMenu::widget([
'dataProvider' => $dataProvider,
'columns' => $columns,
'exportConfig' => [
ExportMenu::FORMAT_TEXT => false,
ExportMenu::FORMAT_HTML => false,
ExportMenu::FORMAT_EXCEL => false,
ExportMenu::FORMAT_EXCEL_X => false,
ExportMenu::FORMAT_PDF => false,
],
'filename' => 'export-faktur',
'noExportColumns' => [0, 7, 15, 16],
'hiddenColumns' => [],
'showColumnSelector' => false,
'pjax' => true,
'clearBuffers' => true,
'dropdownOptions' => [
'class' => 'btn-primary btn-sm',
'title' => Yii::t('kvexport', 'Export data in selected format'),
'icon' => '<i class="fas fa-file-download"></i>',
'itemsBefore' => [
'<div class="dropdown-header">Eksportuj całą listę</div>',
],
],
'options' => [
'id' => 'expFullInvoiceMenu',
],
'target' => ExportMenu::TARGET_SELF,
'exportContainer' => ['class' => 'btn-group-md'],
]);
I tried to use krajeeDialogSettings but it doesn't work. How do I get to the dialog styling options? I need to change the color of the dialog and add classes to the buttons. I don't want to overwrite classes in css.
Related
I have a problem with editable kartik, how can I make editable kartik stored in the database? sometimes BAD REQUEST notifications appear
My Controller
public function actions()
{
return ArrayHelper::merge ( parent::actions () , [
'editable' => [
'class' => EditableColumn::className() ,
'modelClass' => AssetMasterRequest::className() ,
'forceCreate'=> false,
]
]);
}
My View
<?php
$gridColumns = [
'assetMaster.asset_name',
'request_date',
[
'class' => 'kartik\grid\EditableColumn',
'attribute' => 'requested_by',
'pageSummary' => 'Total',
'vAlign' => 'middle',
'width' => '210px',
'editableOptions' => function ($model, $key, $index) use ($ambildata) {
return [
'header' => 'Request By',
'formOptions' => ['action'=>'pru'] ,
'size' => 'md',
'afterInput' => function ($form, $widget) use ($model, $index) {
return $form->field($model, "request_notes");
}
];
}
],
[
'class' => 'kartik\grid\EditableColumn',
'attribute' => 'request_notes',
'vAlign' => 'middle',
'width' => '210px',
'editableOptions' =>[
'formOptions'=>[
'action'=>'editable'
],
]
],
'requested_by',
];?>
Please help. Have spent two days on this. Thanks!
You must return a JSON encoded response in the array format specified above with output and message values. This is important for the AJAX request to be processed and completed successfully.
Here is a grid view configuration with editable column
echo GridView::widget([
'id' => 'kv-grid-demo',
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => $gridColumns, // check the configuration for grid columns by clicking button above
'containerOptions' => ['style' => 'overflow: auto'], // only set when $responsive = false
'headerRowOptions' => ['class' => 'kartik-sheet-style'],
'filterRowOptions' => ['class' => 'kartik-sheet-style'],
'pjax' => true, // pjax is set to always true for this demo
// set your toolbar
'toolbar' => [
[
'content' =>
Html::button('<i class="fas fa-plus"></i>', [
'class' => 'btn btn-success',
'title' => Yii::t('kvgrid', 'Add Book'),
'onclick' => 'alert("This will launch the book creation form.\n\nDisabled for this demo!");'
]) . ' '.
Html::a('<i class="fas fa-redo"></i>', ['grid-demo'], [
'class' => 'btn btn-outline-secondary',
'title'=>Yii::t('kvgrid', 'Reset Grid'),
'data-pjax' => 0,
]),
'options' => ['class' => 'btn-group mr-2']
],
'{export}',
'{toggleData}',
],
'toggleDataContainer' => ['class' => 'btn-group mr-2'],
// set export properties
'export' => [
'fontAwesome' => true
],
// parameters from the demo form
'bordered' => $bordered,
'striped' => $striped,
'condensed' => $condensed,
'responsive' => $responsive,
'hover' => $hover,
'showPageSummary' => $pageSummary,
'panel' => [
'type' => GridView::TYPE_PRIMARY,
'heading' => $heading,
],
'persistResize' => false,
'toggleDataOptions' => ['minCount' => 10],
'exportConfig' => $exportConfig,
'itemLabelSingle' => 'book',
'itemLabelPlural' => 'books'
]);
My code is:
<?= $form->field($model, 'imageFiles[]')->widget(FileInput::classname(), [
'options' => ['multiple' => true, 'accept' => 'image/*', 'id'=>'inputFile'],
'pluginOptions' => [
'rtl'=>'true',
'fileActionSettings'=>['showZoom'=>true, 'showRemove' =>true,
'showDrag'=>true],
previewFileType' => 'image',
'maxFileCount' => 4,
'showUpload' => false,
],
]);
but 'fileActionSettings' not working for me and The buttons are not displayed, please help me if I'm wrong.
I have customized my gridview in Yii2 to show columns, headers, and pager in a certain way
'dataProvider' => $dataProvider,
//'filterModel' => $searchModel,
'filterSelector' => 'select[name="per-page"]',
'tableOptions'=> ['class'=>'table datatable-header-footer datatable-header-footer'],
'showFooter' => true,
'layout'=>"{items}\n\n{summary}\n\n<div class='text-right'>{pager}</div>\n",
//'summary' => "{begin} - {end} {count} {totalCount} {page} {pageCount}",
'summary' => " <br/> Affichage de {begin} à {end} des {totalCount} lignes <br/> <br/>",
'formatter' => ['class' => 'yii\i18n\Formatter','nullDisplay' => ' - '],
'pager' => [
'nextPageLabel' => '→',
'prevPageLabel' => '←',
'firstPageLabel' => true,
'maxButtonCount' => 5,
'lastPageLabel' => true
],
'columns' => [
// ['class' => 'yii\grid\SerialColumn'],
//'id', ...
['class' => 'yii\grid\ActionColumn',
'contentOptions' => ['style' => 'width:10%;'],
'header'=>'Actions',
'template' => '{all}',
'buttons' => [
'all' => function ($url, $model, $key) {
return ButtonDropdown::widget([
'encodeLabel' => false,
'label' => 'Choisir',
'dropdown' => [
'encodeLabels' => false,
'items' => [
[
'label' => \Yii::t('yii', '<i class="icon-search4"></i> Details'),
'url' => ['view', 'id' => $key],
],
[
'label' => \Yii::t('yii', '<i class="icon-pencil5"></i> Modifier'),
'url' => ['update', 'id' => $key],
'visible' => true,
],
[
'label' => \Yii::t('yii', '<i class="icon-list"></i> Annonces'),
'url' => ['annonces', 'agence_id' => $key],
'visible' => true,
],
[
'label' => \Yii::t('yii', '<i class="icon-list2"></i> Agents'),
'url' => ['professionnels', 'agence_id' =>$key],
'visible' => true,
],
[
'label' => \Yii::t('yii', '<i class="icon-bin"></i> Supprimer'),
'linkOptions' => [
'data' => [
'method' => 'post',
'confirm' => \Yii::t('yii', 'Are you sure you want to delete this item?'),
],
],
'url' => ['delete', 'id' => $key],
'visible' => true, // same as above
],
],
'options' => [
'class' => 'dropdown-menu-right', // right dropdown
],
],
'options' => [
'class' => 'btn-default',
'style' => 'padding-left: 5px; padding-right: 5px;', // btn-success, btn-info, et cetera
],
'split' => true,
]);
Im wondering if there is a way to create a gridview "style" so I can call and apply this style to every gridview in the project !
Yes, extend GridView class with your own, set all properties, override anything you need and use your class instead of default GridView.
i am working with Yii2 and using Editable Widget
My code is below
Editable::widget([
'id' => 1,
'name' => 'assignTo',
'value' => 1,
'url' => 'url here',
'type' => 'select',
'mode' => 'inline',
'clientOptions' => [
'toggle' => 'dblclick',
'emptytext' => 'Unassigned',
'placement' => 'right',
'select2' => [
'width' => '124px'
],
'source' => 1,
'value' => 1,
],
]);
i want to add custom attribute on that generated html tag. i have tried as below but its throw error
Editable::widget([
'id' => 'assignTo_'.$todo->id,
'name' => 'assignTo',
'redirect_url' => 'custom_attriute', // this is custom attribute that i need
'class' => 'my own custom class', // this is custom attribute that i need
'value' => 1,
'url' => 'url here',
'type' => 'select',
'mode' => 'inline',
'clientOptions' => [
'toggle' => 'dblclick',
'emptytext' => 'Unassigned',
'placement' => 'right',
'select2' => [
'width' => '124px'
],
'source' => 1,
'value' => 1,
],
]);
and also i want to add my own class in the generated html i have tried same as above but its not working.
is there any way to make it possible what i want?
dosamigos\editable\Editable extends yii\widgets\InputWidget which has an $options variable that holds:
The HTML attributes for the input tag.
Editable::widget([
'id' => 'assignTo_'.$todo->id,
'name' => 'assignTo',
'options' => [
'redirect_url' => 'custom_attriute', // this is custom attribute that i need
'class' => 'my own custom class', // this is custom attribute that i need
],
'value' => 1,
'url' => 'url here',
'type' => 'select',
'mode' => 'inline',
'clientOptions' => [
'toggle' => 'dblclick',
'emptytext' => 'Unassigned',
'placement' => 'right',
'select2' => [
'width' => '124px'
],
'source' => 1,
'value' => 1,
],
]);
I have installed in Yii 1.1
$this->widget('zii.widgets.CListView', array(
'template' => Yii::t('Site','Header News')
But how 'to do it in Yii2 ?
echo ListView::widget(['template' => Yii::t('Site','Header News'),
'dataProvider' => $tipsList,
'itemView' => '_listItem',
'layout' => '{items}{pager}',
'itemOptions' => [
],
'options' => [
'links' => '<h2>test</h2>',
'tag' => 'ul',
'class' => 'ten-vertical summary-list',
],
'viewParams' => array(
'categoryAlias' => $categories[0]->urlAlias,
'imageConfig' => array('width' => 120, 'height' => 120, 'fill' => true),
'firstImageConfig' => array('width' => 436, 'height' => 436, 'fill' => true),
),
]);
Param 'template' => Yii::t('Site','Header News') does not work
template property of ListView in Yii2 called layout. Link
Example:
'layout' => '<li class="list-header">Header</li>{items}{pager}',
'options' => [
'tag' => 'ul',
],
The li.list-header will be added into a parent tag ul