I am using CGridView it's working fine but I have a small prob.
The rows overlap (see screen below), I start using Ecolumns Extension to manage the columns.
But sometime I need to display all the columns and it's not convenient at all (specially on mobile devices)
Here is a JSFiddle example
Does anybody have any idea on how to manage that, in order to make all the rows fit inside the Grid even if all the columns are displayed, please ?
thank you
Edit : The Generated HTML code
<div style="display: none" id="*****-grid-ecolumns-dlg">
<form id="*****-grid-ecolumns" action="/*****/index.php?r=*****" method="POST">
<input type="hidden" value="1" name="*****-grid-ecolumns-set" id="*****-grid-ecolumns-set" />
<ul id="yw1">
<li class="ui-state-default" id="*****"><label><input type="checkbox" name="*****-grid-ecolumns[]" value="****" checked> ****</label></li>
<li class="ui-state-default" id="user_id"><label><input type="checkbox" name="*****-grid-ecolumns[]" value="user_id" checked> User</label></li>
</ul>
<div><input type="submit" onclick="$("#*****-grid-ecolumns-dlg").dialog("close")" style="float: left" name="yt1" value="Apply" />
<input type="button" onclick="$("#*****-grid-ecolumns-dlg").dialog("close"); return false;" style="float: right" name="yt0" value="Close" />
<input type="button" class="reset" value="Reset" style="float: right">
</div></form></div>
<div class="grid-view rounded" id="*****-grid">
<a class="ecolumns-link" id="*****-grid-ecolumns-dlg-link" href="#">Settings</a>
<div class="summary">Displaying 1-50 of 556 results.</div>
<table class="items">
<thead><tr>
<th id="*****-grid_c0">
<a class="sort-link" href="/*****/index.php?r=*****/index&*****_sort=*****_id">*****</a>
</th>
<th id="*****-grid_c1">
<a class="sort-link" href="/*****/index.php?r=*****/index&*****_sort=user_id">User</a></th>
</thead>
<tbody>
<tr class="odd">
<td>*</td><td>*</td>
<td>***</td><td>***</td>
<td>***</td><td></td>
<td></td><td></td>
<td>***</td><td></td>
<td></td><td></td>
<td>***</td><td>***</td>
<td class="button-column"><a class="update" title="Update" href="/*****/index.php?r=*****/update&id=4">
<img src="/******/gr-update.png" alt="Update" /></a>
<a title="Edit" href="****">
<img src="****/home.jpg" alt="edit" />
</a></td></tr>
</tbody></table> </div>
The PHP Code
<?php
$dialog = $this->widget('ext.ecolumns.EColumnsDialog', array(
'options'=>array(
'title' => 'Table Settings',
'autoOpen' => false,
'show' => 'fade',
'hide' => 'fade',
),
'htmlOptions' => array('style' => 'display: none'), //disable flush of dialog content
'ecolumns' => array(
'gridId' => '*****-grid', //id of related grid
'storage' => 'session', //where to store settings: 'db', 'session', 'cookie'
// 'fixedLeft' => array('CCheckBoxColumn'), //fix checkbox to the left side
'model' =>$dataProvider->model, //model is used to get attribute labels
'columns'=>array(
'*****_id',
'user_id',
....
....
array('header'=>'Operations',
'class'=>'CButtonColumn',
'viewButtonImageUrl' => Yii::app()->baseUrl . '/css/gridViewStyle/images/' . 'gr-view.png',
'updateButtonImageUrl' => Yii::app()->baseUrl . '/css/gridViewStyle/images/' . 'gr-update.png',
//'deleteButtonImageUrl' => Yii::app()->baseUrl . '/css/gridViewStyle/images/' . 'gr-delete.png',
'template'=>'{update}{edit}',
),
),
),
));
$this->widget('zii.widgets.grid.CGridView', array(
'id' => '*****-grid',
'dataProvider'=>$dataProvider,
'template' => $dialog->link()."{summary}\n{items}\n{pager}",
'pager' => array('cssFile' => Yii::app()->baseUrl . '/css/gridViewStyle/gridView.css'),
'cssFile' => Yii::app()->baseUrl . '/css/gridViewStyle/gridView.css',
'htmlOptions' => array('class' => 'grid-view rounded'),
'columns' => $dialog->columns(),
//'itemView'=>'_brochureview',
//'columns' => 3
//'filter'=>$model,
));
?>
Here is the additional CSS you need for the table. However, by fitting everything to the width of the window, it will look squishy on smaller screens. This will also make each table cell equal width by default. You may want to use a CSS media query to apply this only to smaller screens.
.grid-view table.items {
width: 100%;
table-layout: fixed;
}
Updated fiddle:
http://jsfiddle.net/37m6ja3v/2/
Related
I am working on one project and got some brain storming question.
I am trying to do the card in aspdotnet core application in .cshtml file.
but by default the cards are arrange in vertical manner. I want them into the horizontal manner. What should I do for it.?
The folowing is the code for index.cshtml file:
#foreach (var item in Model)
{
<div class="card border-warning card-columns" style="width: 18rem;">
<div class="card-body">
<strong>#Html.DisplayNameFor(model => model.EquipmentName) : </strong>
<p> #Html.DisplayFor(modelItem => item.EquipmentName)</p>
<strong>#Html.DisplayNameFor(model => model.EquipmentSetValueTemp) : </strong>
<p> #Html.DisplayFor(modelItem => item.EquipmentSetValueTemp)</p>
<strong>#Html.DisplayNameFor(model => model.EquipmentProcessValueTemp) : </strong>
<p> #Html.DisplayFor(modelItem => item.EquipmentProcessValueTemp)</p>
<a asp-action="Details" asp-route-id="#item.EquipmentId" class="btn btn-primary">Details</a>
<a asp-action="Delete" asp-route-id="#item.EquipmentId" class="btn btn-primary">Delete</a>
</div>
</div>
}
I got An answer.
Just add the style like display:inlin-block;
and delete the card-columns form class name.
New index.cshtml file :
#foreach (var item in Model)
{
<div class="card border-warning" style="width: 18rem; display:inline-block;">
<div class="card-body">
<strong>#Html.DisplayNameFor(model => model.EquipmentName) : </strong>
<p> #Html.DisplayFor(modelItem => item.EquipmentName)</p>
<strong>#Html.DisplayNameFor(model => model.EquipmentSetValueTemp) : </strong>
<p> #Html.DisplayFor(modelItem => item.EquipmentSetValueTemp)</p>
<strong>#Html.DisplayNameFor(model => model.EquipmentProcessValueTemp) : </strong>
<p> #Html.DisplayFor(modelItem => item.EquipmentProcessValueTemp)</p>
<a asp-action="Details" asp-route-id="#item.EquipmentId" class="btn btn-primary">Details</a>
<a asp-action="Delete" asp-route-id="#item.EquipmentId" class="btn btn-primary">Delete</a>
</div>
</div>
}
Use following style in inline CSS
style="width: 18rem;display:inline-block; margin:10px"
I use this hook:
add_action( 'woocommerce_after_checkout_billing_form', 'add_custom_field' );
function add_custom_field( $checkout ) {
echo '<div id="custom_field_wrapper">';
woocommerce_form_field( 'custom_field', array(
'type' => 'text',
'class' => array('custom_field_class'),
'label' => __('Custom Field'),
'placeholder' => __('Please input value ...'),
'required' => false, ),
$checkout->get_value( 'custom_field' ) );
echo '</div>';
}
and i get this markup:
<div id="custom_field_wrapper">
<p class="form-row custom_field_class" id="custom_field_field" data-priority="">
<label for="custom_field" class="">Custom Field</label>
<input type="text" class="input-text " name="custom_field" id="custom_field" placeholder="Please input value ..." value="">
</p>
</div>
But the required markup looks like this:
<div class="row order-form__row">
<div class="col-lg-3 col-md-4">
<label class="label" for="index-field">Индекс:</label>
</div>
<div class="col-lg-6 col-md-6">
<input class="input" type="text" name="index" id="index-field"/>
</div>
<div class="col-lg-3 col-md-2"><a class="field-after" href="javascript:void(0);" target="_blank">Забыли индекс?</a></div>
</div>
Kind smart people help solve the dilemma ... How to change the html markup according to the requirements?
i am creating a form with cakephp2 and bootstrap everything is working fine but im stuck in little confusion and i cant fix this kindly any bootstrap or cake expert help me thanks,
Check this envelop its stretching upwards
here is my code
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">
<span class="glyphicon glyphicon-envelope"></span>
</span>
<?php echo $this->Form->input('email',
array(
'class' => 'form-control',
'type' => 'email',
'placeholder' => 'Enter Email'
)
); ?>
</div>
<!--<input type="email" class="form-control" id="email" placeholder="Enter email" required="required" /></div>-->
</div>
Pass the argument 'label' => false will prevent to display the label
Use
<?php echo $this->Form->input('email',
array(
'class' => 'form-control',
'type' => 'email',
'placeholder' => 'Enter Email',
'label' => false
)
); ?>
You should use label false in your code.
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">
<span class="glyphicon glyphicon-envelope"></span>
</span>
<?php echo $this->Form->input('email',
array(
'class' => 'form-control',
'type' => 'email',
'label'=>false,
'placeholder' => 'Enter Email'
)
); ?>
</div>
<!--<input type="email" class="form-control" id="email" placeholder="Enter email" required="required" /></div>-->
</div>
I have navigation header like this:
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-collapse collapse">
<form class="navbar-form navbar-right" role="search">
<div class="form-group has-feedback">
<input id="searchbox" type="text" placeholder="Search" class="form-control">
<span id="searchicon" class="fa fa-search form-control-feedback"></span>
</div>
</form>
</div><!--/.navbar-collapse -->
</div>
</div>
I have problem when I want to convert this code using yii\bootstrap\NavBar;:
<div class="navbar-collapse collapse">
<form class="navbar-form navbar-right" role="search">
<div class="form-group has-feedback">
<input id="searchbox" type="text" placeholder="Search" class="form-control">
<span id="searchicon" class="fa fa-search form-control-feedback"></span>
</div>
</form>
</div><!--/.navbar-collapse -->
And this is the code of my Layout using yii\bootstrap\NavBar;:
<?php
NavBar::begin([
'brandLabel' => 'My Company',
'brandUrl' => Yii::$app->homeUrl,
'options' => [
'class' => 'navbar navbar-inverse navbar-fixed-top',
'role' => 'navigation',
],
]);
NavBar::end();
?>
I have been read Navbar Widget, but still don't understand. Is there anyone who can teach me to using Navbar widget on Yii2 framework?.
Ok here is the code for that,here i am just placing the searchbox from exactly what you posted in question and i am guessing that you know how to echo other menu links in navbar
Anyway it goes like this
<?php
NavBar::begin([
'brandLabel' => 'My Company',
'brandUrl' => Yii::$app->homeUrl,
'options' => [
'class' => 'navbar navbar-inverse navbar-fixed-top',
'role' => 'navigation',
],
]);
$menuItems = [
['label' => 'Home', 'url' => ['controller url here']],
];
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'],
'items' => $menuItems,
]);
echo "<form class='navbar-form navbar-right' role='search'>
<div class='form-group has-feedback'>
<input id='searchbox' type='text' placeholder='Search' class='form-control'>
<span id='searchicon' class='fa fa-search form-control-feedback'></span>
</div>
</form>";
NavBar::end();
?>
Hi I am Having a View Where I am using Kendo Grid.I am editing the row of the table but getting the error.Here is my Code goes.
#(Html.Kendo().Grid<Invoice.Models.ViewModels.Setup.AccountViewModel>()
.Name("Account")
.Columns(columns =>
{
columns.Bound(p => p.AccountID).Title("ID").Width(250);
columns.Bound(p => p.AccountType).Title("Account Type").Width(225);
columns.Bound(p => p.AccountName).Title("Account Name").Width(225);
columns.Bound(p => p.Currency).Title("Currency").Width(225);
columns.Bound(p => p.Status).ClientTemplate("#=data.Status#").Width(225).HtmlAttributes(new {style="text-align:center"});
//columns.Command(command => command.Custom("Edit").Click("showDetails")).Title("Action").Width(150);
columns.Command(command => { command.Edit();}).Width(90);
})
.ToolBar(toolbar =>
{
toolbar.Template(#<text>
<div class="row-fluid">
<div class="span1">
<div class="toolbar" style="height:25px;">
<ul id="menu" style="width:38px; margin-left:22px;" class="span6">
<li style="width:36px;">
<i class="fa fa-plus"></i>
<ul>
#foreach (var account in #ViewBag.AccountType)
{
<li style="width:100px;" class="openid">
#if (#account.Value == "Bank")
{
<label id="Bank1">#account.Value</label>
}
#if (#account.Value == "CreditCard")
{
<label id="Credit">#account.Value</label>
}
#if (#account.Value == "Cash")
{
<label id="Cash1">#account.Value</label>
}
</li>
}
</ul>
</li>
</ul>
</div>
</div>
</div>
</text>);
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.HtmlAttributes(new { style = "height:550px;" })
//.Selectable(selectable => selectable
//.Mode(GridSelectionMode.Multiple))
.Editable(ed => ed.Mode(GridEditMode.PopUp).TemplateName("UpdateAccount"))
.DataSource(dataSource => dataSource
.Ajax()
.Events(events => events.Error("error_handler"))
//.ServerOperation(true)
.Model(model => model.Id(p => p.AccountID))
.Read(read => read.Action("Account_Read", "Setup"))
.Create(c => c.Action("Account_Create", "Setup"))
.Update(u => u.Action("Account_Update","Setup"))
)
)
Now the thing is that I am fetching the "Status" from the database that is a HTML tag <span class="label label-success">Active</span> and converting this into the label As Active,InActive and Blocked and Displaying it into the Grid but the problem is that when i am editing this i am getting this error.
"A potentially dangerous Request.Form value was detected from the client (Status="
Here i am using My own template as
UpdateAccount(.Editable(ed => ed.Mode(GridEditMode.PopUp).TemplateName("UpdateAccount")))
wherein i am not including the Status Field but still getting this error.
My UpdateAccount template is as Follows:
<input type="hidden" name="AccountID" id="AccountID" />
<div class="control-group">
<label class="control-label">Account Type</label>
<div class="controls">
<input type="text" name="AccountType" id="AccountType" />
</div>
</div>
<div class="control-group">
<label class="control-label">Account Name</label>
<div class="controls">
<input type="text" name="AccountName" id="AccountName" />
</div>
</div>
<div class="control-group">
<label class="control-label">Currency</label>
<div class="controls">
<input type="text" name="Currency" id="Currency" />
</div>
</div>
Please help me !!!
You can set a template for just one column like this :
columns.Bound(p => p.AccountType)
.Title("Account Type")
.Width(225)
.Template(#<img src="./Images/accountIco.png" title="#item.AccountName" />#item.AccountType);