Vuetify Data Table expand columns how to add expand button - datatable

I am new to Vuetify I and want to add expandable rows to my table. How can I add
{ text: '', value: 'data-table-expand' } to my headers?
My headers look like the following:
headers: VuetifyDataTableHeader<
IncidentNotificationPlan & {
inpOperation: unknown;
inpActionTypeIcon: unknown;
ttaat: string;
dueTime: string;
inpActionOperation: unknown;
}
>[] = [
{ text: $t('Ticket'), value: 'ticketNumber', width: '15%' },
{ text: '', value: 'user', width: '68px' },
{ text: $t('Plan Name'), value: 'name' },
{ text: '', value: 'inpOperation', width: '120px' },
{ text: $t('Host(s)'), value: 'hosts', width: '18%' },
{ text: $t('Action'), value: 'inpActionTypeIcon', width: '90px' },
{ text: $t('TTAAT'), value: 'ttaat', width: '90px' },
{ text: $t('Due Time'), value: 'dueTime', width: '120px' },
{ text: '', value: 'inpActionOperation', width: '120px' },
];
I want the icon to be displayed in the column of hosts. Can anybody help me out?

Related

Sencha Ext JS - how to refresh the Tabs after date picking?

I have MVC app, it's a Tab Panel containing few Tabs with a chart on each, there is also a Date Picker with Refresh button, and a Combo box to choose which data source is being used for the 'Date Range'.
The app currently loads the charts with all available data but the purpose is to select 1 of 3 available data sources, select a date range and refresh every chart tab by clicking a button, how do I do it?
Fiddle sample
Something like this:
Ext.create('Ext.panel.Panel', {
renderTo: Ext.getBody(),
height: 800,
width: 800,
layout: 'border',
defaults: {
collapsible: false,
split: true,
},
items: [{
title: 'PanelCenter',
xtype: 'tabpanel',
region: 'center',
itemId: 'centerPanel',
bodyPadding: 10,
activeTab: 0,
items: [{
title: "Tab1",
items: {
xtype: 'cartesian',
width: 655,
height: 400,
store: {
fields: ['name', 'value'],
data: [{
name: 'metric one',
value: 10,
}, {
name: 'metric two',
value: 7,
}, {
name: 'metric three',
value: 5,
}]
},
axes: [{
type: 'numeric',
position: 'left',
title: {
text: 'Sample Values',
fontSize: 15
},
}, {
type: 'category',
position: 'bottom',
title: {
text: 'Sample Values',
fontSize: 15
},
fields: 'name',
}],
series: [{
type: 'bar',
xField: 'name',
yField: 'value'
}
]
}
}, {
title: "Tab2",
items: {
xtype: 'cartesian',
width: 655,
height: 400,
store: {
fields: ['name', 'value'],
data: [{
name: 'metric one',
value: 3,
}, {
name: 'metric two',
value: 5,
}, {
name: 'metric three',
value: 10,
}]
},
axes: [{
type: 'numeric',
position: 'left',
title: {
text: 'Sample Values',
fontSize: 15
},
}, {
type: 'category',
position: 'bottom',
title: {
text: 'Sample Values',
fontSize: 15
},
fields: 'name',
}],
series: [{
type: 'bar',
xField: 'name',
yField: 'value'
}
]
}
}, {
title: "Tab3",
items: {
xtype: 'cartesian',
width: 655,
height: 400,
store: {
fields: ['name', 'value'],
data: [{
name: 'metric one',
value: 10,
}, {
name: 'metric two',
value: 3,
}, {
name: 'metric three',
value: 9,
}]
},
axes: [{
type: 'numeric',
position: 'left',
title: {
text: 'Sample Values',
fontSize: 15
},
}, {
type: 'category',
position: 'bottom',
title: {
text: 'Sample Values',
fontSize: 15
},
fields: 'name',
}],
series: [{
type: 'bar',
xField: 'name',
yField: 'value'
}
]
}
}]
}, {
xtype: 'form',
title: 'PanelTop',
layout: {
type: 'hbox',
},
region: 'north',
border: false,
bodyPadding: 10,
height: '100',
width: '100%',
margin: '0 0 5 0',
region: 'north',
items: [{
xtype: 'combo',
name: 'data_type',
itemId: 'dataTypeSelect',
emptyText: 'Select date type',
displayField: 'source',
store: {
fields: ['code', 'source'],
data: [{
code: 'created',
source: 'Sales date'
}, {
code: 'invoice',
source: 'Invoice date'
}, {
code: 'bookIn',
source: 'Order date'
}]
},
allowBlank: false,
}, {
xtype: 'datefield',
itemId: 'dateFromSearchField',
fieldLabel: 'From',
labelAlign: 'right',
name: 'from_date',
format: 'd/m/Y',
maxValue: new Date(),
allowBlank: false,
}, {
xtype: 'datefield',
itemId: 'dateToSearchField',
fieldLabel: 'To',
labelAlign: 'right',
name: 'to_date',
format: 'd/m/Y',
maxValue: new Date(),
value: new Date(),
padding: '0 30 0 0',
allowBlank: false
}, {
xtype: 'button',
itemId: 'refreshButton',
region: 'center',
text: 'Refresh',
formBind: true,
handler: function () {
const formData = this.up('panel').getValues();
if (
formData.data_type && formData.from_date && formData.to_date
) {
const tabPanel = Ext.ComponentQuery.query('tabpanel#centerPanel')[0];
const cartesianCharts = tabPanel.query('cartesian');
Ext.Array.each(cartesianCharts, function (cartesianChart) {
cartesianChart.getStore().load({
params: formData,
callback: function (records, operation, success) {
},
scope: this
});;
}, this);
}
}
}],
}]
});

Extjs on resize column width textfield Ui get destroyed

Basically, the problem that I have is the following:
When I resize the column in my GridPanel the textbox UI near Name get destroyed: the line on the right disappear. It should instead resize according to the width. How could I fix it?
This is my code:
...
columns: {
defaults: {
flex: 1,
},
layout:'auto',
items: [{
text: Strings.sharedName,
flex: 1,
minWidth: Traccar.Style.columnWidthNormal,
dataIndex: 'name',
//style: 'text-align:right;!important',
filter: 'string',
defaults: {
margin: '-28 30 -5 50'
},
items: [{
xtype: 'container',
layout: {
type: 'vbox',
align: 'right'
},
flex: 2,
items: [{
xtype: 'textfield',
id: 'nameFilter',
listeners: {
change: function(field, value) {
filterGrid('name', value);
}
}
}]
}]
}
...
Here a reproducible example:
https://fiddle.sencha.com/#view/editor&fiddle/3a41

how to filter record from jqGrid using html dropdown using id

i am using jqgrid and i am to filter record from combo data is loaded from database .enter image description here
Screen 1
Controler
public JsonResult Getlist(int id,int LstatusId, bool AllDate,string DateFrom,string DateTo)
{
List<leadMaster> lmasterRecords = new List<leadMaster>();
using (SqlConnection con = new SqlConnection(constring))
{
using (SqlCommand cmd = new SqlCommand("SP_leadMasterDetail", con))
{
if (clsCommon._UserType == "A")
cmd.Parameters.AddWithValue("#AgentID", id);
else
cmd.Parameters.AddWithValue("#AgentID", clsCommon._AgentID);
cmd.Parameters.AddWithValue("#LeadStatusID",LstatusId);
cmd.Parameters.AddWithValue("#AllDates",AllDate);
cmd.Parameters.AddWithValue("#DateFrom",DateFrom);
cmd.Parameters.AddWithValue("#DateTo",DateTo);
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
lmasterRecords.Add(
new leadMaster
{
RecordID = Convert.ToInt64(reader.GetValue(0)),
Name = reader.GetString(1),
CityName = reader.GetString(2),
CountryName=reader.GetString(3),
Address=reader.GetString(4),
PhoneNo=reader.GetString(5),
MobileNo=reader.GetString(6),
Email=reader.GetString(7),
EnteryDate = reader.GetDateTime(8).ToShortDateString(),
ProfType=reader.GetString(9),
LeadStatus=reader.GetString(10),
ProjName=reader.GetString(11),
UnitTypeName=reader.GetString(12),
Description=reader.GetString(13),
User_name=reader.GetString(14),
IsClose=reader.GetString(15)
}
);
}
}
}
return Json(lmasterRecords, JsonRequestBehavior.AllowGet);
}
DropDown boxs
Filter By Agent:
#Html.DropDownList("var1", null, new { #class = "form-control col-sm-3 " })
JqGrid Function
script>
$.noConflict();
jQuery(document).ready(function ($) {
$("#jqGrid").jqGrid({
url: '#Url.Action("Getlist")',
datatype: 'json',
mtype: 'Get',
page: 1,
postData: { id: $("#var1").val(), LstatusId: $("#var2").val(), AllDate: $("#AllData").attr("checked") ? true : false, DateFrom: $("#cmbSDate").val(), DateTo: $("#cmbTDate").val() },
colModel: [
{ label:'RecordID', hidden: true, name: 'RecordID', key: true, width: 75 },
{ label: 'Name', name: 'Name', width: 200 },
{ label: 'CityName', name: 'CityName', width: 110 },
{ label: 'CountryName', hidden: true, name: 'CountryName', width: 150 },
{ label: 'Address', hidden: true, name: 'Address', width: 150 },
{ label: 'PhoneNo', hidden: true, name: 'PhoneNo', key: true, width: 75 },
{ label: 'MobileNo', name: 'MobileNo', width: 110 },
{ label: 'Email', name: 'Email', width: 200 },
{ label: 'Fax', hidden: true, name: 'Fax', width: 150 },
{ label: 'LeadDate', name: 'EnteryDate', width: 100 },
{ label: 'ProfType', hidden: true, name: 'ProfType', width: 150 },
{ label: 'LeadStatus', name: 'LeadStatus', key: true, width: 150 },
{ label: 'Description', name: 'Description', width:110 },
{ label: 'UnitTypeName', name: 'UnitTypeName', width: 150 },
{ label: 'User_name', name: 'User_name', width: 150 },
{ label: 'IsClose', name: 'IsClose', width: 50}],
loadonce:true,
viewrecords: true,
width: 1050,
height: 350,
rowNum: 100,
rowList: [10, 20, 30,50,100,500],
pager: "#jqGridPager"
});
});
</script>

ExtJs 5 how add item to dashboard programmatically?

I need some help. When creating dashboard I know that it need to fill parts object
parts: {
portlet: {
viewTemplate: {
layout: 'fit',
html: 'messafe from portlet'
}
},
portlet2: {
viewTemplate: {
layout: 'fit',
html: 'message from portlet2'
}
}
}
also I know that I can use them below to render parts
defaultContent: [{
type: 'portlet',
title: 'Test1',
columnIndex: 0,
height: 500
}, {
type: 'portlet2',
title: 'Test2',
columnIndex: 1,
height: 300
}, {
type: 'portlet',
title: 'Test3',
columnIndex: 1,
height: 300
}, {
type: 'portlet',
title: 'Test4',
columnIndex: 2,
height: 350
}, {
type: 'portlet',
title: 'Test5',
columnIndex: 3,
height: 350
}]
now my question is now add(do all this job) programmatically? for example I want to create new component on button click

Format Kendo Grid to display dollars sign and allow up to two decimal?

I have a kendo Grid that I create like this:
function drawInvoiceTable() {
invoiceTable = $('#invoiceGrid').kendoGrid({
sortable: true,
pageable: true,
dataSource: {
data: getData(),
pageSize: 10,
schema: {
model: {
id: 'test',
fields: {
active: false
}
}
}
},
columns: [
{ template: "<input type='checkbox' id='chkInvoices' class='invoiceDisplay' name='chkInvoices' #= active ? checked='checked' : '' #/>", width: 30 },
{ field: 'accountNumber', title: 'Account', attributes: { 'class': 'accountnumber' }, sortable: true },
{ field: 'transactionDate', title: 'Trans Date', attributes: { 'class': 'transdate' }, width: 100, sortable: true },
{ field: 'TransType', title: 'Type', attributes: { 'class': 'transType' }, width: 60, sortable: true },
{ field: 'TransReferenceNumber', title: 'Reference Number', attributes: { 'class': 'refnumber' }, width: 135, sortable: true },
{ field: 'transactionDebitAmount', title: 'Amount', attributes: { 'class': 'amount' }, width: 90, sortable: true },
{ field: 'openBalance', title: 'Balance', width: 90, attributes: { 'class': 'balance' }, template: '#= kendo.format("{0:p}", openBalance) #', sortable: true },
{ field: 'discountAmount', title: 'Discount', format: "{0:c}", attributes: { 'class': 'discount', 'data-format': 'c' }, width: 90, sortable: false },
{ field: 'discountApplied', title: 'Discount Applied', width: 95, attributes: { 'class': 'discapplied' }, sortable: false },
{ field: 'paymentApplied', title: 'Payment Applied' , width: 95, attributes: { 'class': 'paymentapplied' }, sortable: false },
{ field: 'discountDate', title: 'Discount Date', attributes: { 'class': 'discountDate' } },
{ field: 'dueDate', title: 'Due Date', width: 90, sortable: true }
]
});
grid = $('#invoiceGrid').data('kendoGrid');
dataSource = grid.dataSource;
data = dataSource.data();
}
How can I have the values in some of my columns formatted with the dollar sign and allow up to 2 decimal such as $12541.23 ?
In the column definition use format: "{0:c2}":
{ field:"price", title:"Price", format:"{0:c2}" },
c stands for currency and 2 is the number of decimals
You would want to set the column.format to "{0:c2}"
"c2" is the number format (currency, 2 decimal places) which is defined here.

Resources