Load data into extended Bootstrap table with colspan - twitter-bootstrap-3

Excuse me, now I am using this to make a table. Now I would like one table header to have this property, colspan="6". However, how can I load data into this table?
Note. the table structure is:
<tr>
<th colspan="6" class="col-xs-4" data-field="status" data-sortable="true">Status</th>
</tr>
Note. the way I load data into bootstrap table is:
$("#table").bootstrapTable({data: data});

Bootstrap-table does not support rowspan and colspan Header temporarily.
More info : https://github.com/wenzhixin/bootstrap-table/issues/182
Alternatively, you can try below solution
$('#table').bootstrapTable({
columns: [{
field: 'id',
title: 'Item ID'
}, {
field: 'name',
title: 'Item Name'
},
{
field: 'price',
title: 'Item Price'
},
{
field: 'color',
title: 'Item Color'
},
{
field: 'size',
title: 'Item Size'
},
{
field: 'discount',
title: 'Item Discount'
}],
data: [{
id: 1,
name: 'Item 1',
price: '$1',
color: 'Red',
size: 'XL',
discount: '20%'
},{
id: 2,
name: 'Item 2',
price: '$2',
color: 'Green',
size: 'L',
discount: '30%'
},{
id: 'Total Items',
name: 2
}]
});
$('#table').bootstrapTable('mergeCells', {
index: 2,
field: 'name',
colspan: 5
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.0/bootstrap-table.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.0/bootstrap-table.css" rel="stylesheet"/>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"/>
<table id="table"></table>

Related

Resource squeezed in preview

I'm using this format:
https://fullcalendar.io/js/fullcalendar-scheduler-1.5.1/demos/vertical-resource-view.html
, but when I add more than 4 rooms, it gets squeezed. I wanted that by adding more rooms (I need 12) I would not get everything squeezed. How can I do this?
This my code:
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<link href='../lib/fullcalendar.min.css' rel='stylesheet' />
<link href='../lib/fullcalendar.print.min.css' rel='stylesheet' media='print' />
<link href='../scheduler.min.css' rel='stylesheet' />
<script src='../lib/moment.min.js'></script>
<script src='../lib/jquery.min.js'></script>
<script src='../lib/fullcalendar.min.js'></script>
<script src='../scheduler.min.js'></script>
<script>
$(function() { // document ready
$('#calendar').fullCalendar({
defaultView: 'agendaDay',
defaultDate: '2017-03-06',
editable: true,
selectable: true,
eventLimit: true, // allow "more" link when too many events
header: {
left: 'prev,next today',
center: 'title',
right: 'agendaDay,agendaTwoDay,agendaWeek,month'
},
views: {
agendaTwoDay: {
type: 'agenda',
duration: { days: 2 },
// views that are more than a day will NOT do this behavior by default
// so, we need to explicitly enable it
groupByResource: true
//// uncomment this line to group by day FIRST with resources underneath
//groupByDateAndResource: true
}
},
//// uncomment this line to hide the all-day slot
//allDaySlot: false,
resources: [
{ id: 'a', title: 'Consultório A' },
{ id: 'b', title: 'Consultório B', eventColor: 'green' },
{ id: 'c', title: 'Consultório C', eventColor: 'orange' },
{ id: 'd', title: 'Consultório D', eventColor: 'red' },
{ id: 'e', title: 'Consultório E', eventColor: 'blue' },
{ id: 'f', title: 'Consultório F', eventColor: 'yellow' },
{ id: 'g', title: 'Consultório G', eventColor: 'black' },
{ id: 'h', title: 'Consultório H', eventColor: 'white' },
{ id: 'i', title: 'Consultório I', eventColor: 'gray' },
{ id: 'j', title: 'Consultório J', eventColor: 'brown' },
{ id: 'k', title: 'Consultório K', eventColor: 'purple' },
{ id: 'l', title: 'Consultório L', eventColor: 'purple' },
{ id: 'm', title: 'Consultório M', eventColor: 'purple' }
],
events: [
{ id: '1', resourceId: 'a', start: '2017-03-06', end: '2017-03-08', title: 'event 1' },
{ id: '2', resourceId: 'a', start: '2017-03-07T09:00:00', end: '2017-03-07T14:00:00', title: 'event 2' },
{ id: '3', resourceId: 'b', start: '2017-03-07T12:00:00', end: '2017-03-08T06:00:00', title: 'event 3' },
{ id: '4', resourceId: 'c', start: '2017-03-07T07:30:00', end: '2017-03-07T09:30:00', title: 'event 4' },
{ id: '5', resourceId: 'd', start: '2017-03-07T10:00:00', end: '2017-03-07T15:00:00', title: 'event 5' }
],
select: function(start, end, jsEvent, view, resource) {
console.log(
'select',
start.format(),
end.format(),
resource ? resource.id : '(no resource)'
);
},
dayClick: function(date, jsEvent, view, resource) {
console.log(
'dayClick',
date.format(),
resource ? resource.id : '(no resource)'
);
}
});
});
</script>
<style>
body {
margin: 0;
padding: 0;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
font-size: 14px;
}
#calendar {
max-width: 900px;
margin: 50px auto;
}
</style>
</head>
<body>
<div id='calendar'></div>
</body>
</html>
I also had this problem. My solution was to use this in the eventAfterAllRender callback function.
function eventAfterAllRenderCallback(){
$('.fc-agendaDay-button').click(function(){
$("#schedule_container").css('min-width',$('.fc-resource-cell').length*slot_width_resource);
}
$('.fc-resourceDay-button').click(function(){
$("#schedule_container").css('min-width','');
}
}
The slot_width_resource is the number of pixel wide you want the columns to be (I use 125). Until Fullcalendar comes out with better support this solution has worked work me
Place this function after your fullcalendar initializer and inside the initializer put the callback function like another fullcalendar option
$('#calendar').fullCalendar({
eventAfterAllRender:eventAfterAllRenderCallback,
});

How to remove jQWidgets watermark in grid?

I use the non-commercial version of jQWidgets . When jQWidgets grid loads, a hyperlink "www.jqwidgets.com" appears for about two seconds and then disappears. How to remove watermark in the grid?
Review the Release for jQWidgets v4.1.2.
There says:
Added watermark in major widgets for non-commercial & evaluation
versions. Non-commercial users may request a production build without
the watermark by writing to sales#jqwidgets.com.
You can write to sales#jqwidgets.com and request the production package without watermarks, but only for non-profit projects.
Well, I found a simple way to hide the watermark. In this way, you don't have to modify the source code of jqwidgets. You just need to write a simple css to override the color of watermark element. It will work for all version.
CSS to override the color:
span[id^="jqxWidget"]
{
color: transparent !important;
}
You will find full example in the snippet.
var data = generatedata(500);
var source = {
localdata: data,
datafields: [{
name: 'firstname',
type: 'string'
}, {
name: 'lastname',
type: 'string'
}, {
name: 'productname',
type: 'string'
}, {
name: 'date',
type: 'date'
}, {
name: 'quantity',
type: 'number'
}, {
name: 'price',
type: 'number'
}],
datatype: "array"
};
var adapter = new $.jqx.dataAdapter(source);
$("#jqxgrid").jqxGrid({
width: 500,
theme: 'energyblue',
source: adapter,
sortable: true,
filterable: true,
showfilterrow: true,
columns: [{
text: 'First Name',
datafield: 'firstname',
columngroup: 'Name',
width: 90
}, {
text: 'Last Name',
columngroup: 'Name',
datafield: 'lastname',
width: 90
}, {
text: 'Product',
datafield: 'productname',
width: 170
}, {
text: 'Order Date',
datafield: 'date',
width: 160,
cellsformat: 'dd-MMMM-yyyy'
}, {
text: 'Quantity',
datafield: 'quantity',
width: 80,
cellsalign: 'right'
}, {
text: 'Unit Price',
datafield: 'price',
cellsalign: 'right',
cellsformat: 'c2'
}]
});
$('#jqxgrid').on('filter', function () {
alert("The Grid has been filtered");
});
span[id^="jqxWidget"]
{
color: transparent !important;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
<link href="https://jqwidgets.com/public/jqwidgets/styles/jqx.base.css" rel="stylesheet"/>
<link href="https://jqwidgets.com/public/jqwidgets/styles/jqx.energyblue.css" rel="stylesheet"/>
<script src="https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/generatedata.js"></script>
<div id='jqxWidget'>
<div id="jqxgrid"></div>
</div>
find the code:
String.fromCharCode(119,119,119,46,106,113,119,105,100,103,101,116,115,46,99,111,109)
in all files and replace it with ""
With latest version (non-commercial), I've been able to remove the watermark by adding the following statement:
<script type="text/javascript">
$(document).ready(function () {
jqx.credits = '12F129D4-0E1B-44B8-9BBB-BB4CF78CC6BA';
// do wathever you want with the library there...
});
</script>
Note that the token could be maybe be different for you. You just need search for it in js files.

sencha touch RadioGroup not working

Does RadioGroup works properly in sencha touch ?
Example :
var myRadioGroup = new Ext.form.RadioGroup({
id: 'myGroup',
xtype: 'radiogroup',
fieldLabel: 'Single Column',
// Arrange radio buttons into three columns, distributed vertically
columns: 3,
vertical: true,
items: [
{boxLabel: 'Item 1', name: 'rb', inputValue: '1'},
{boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true},
{boxLabel: 'Item 3', name: 'rb', inputValue: '3'},
{boxLabel: 'Item 4', name: 'rb', inputValue: '4'},
{boxLabel: 'Item 5', name: 'rb', inputValue: '5'},
{boxLabel: 'Item 6', name: 'rb', inputValue: '6'}
]
});
var resultsPanel = Ext.create('Ext.Panel', {
title: 'Results',
style:"margin:50px 0 0 10px;",
layout: {
type: 'vbox', // Arrange child items vertically
align: 'stretch',//, // Each takes up full width
padding: 55
},
defaults: {
labelWidth: '85%',
labelWrap: true,
labelAlign: 'right'
},
items:[{
xtype: 'radiogroup',
fieldLabel: 'RadioGroup',
items:myRadioGroup
}]
});
Ext.viewport.add(resultsPanel);
This generates the following error :
[ERR] C2008: Requirement had no matching files (Ext.form.RadioGroup) -- C:\xampp\htdocs\testRadio\app.js:17:30.
Does anyone have an idea ,i tried updating app.json (not working ) ,also i searched for RadioGroup.js in touch/src/form/ but did not find it .
Sencha don't have radio group field , It has radio field only.
refer this. http://docs-origin.sencha.com/touch/2.4/2.4.1-apidocs/#!/api/Ext.field.Radio
for implementing Radio group give same name to all radio field:
ex:
var form = Ext.create('Ext.form.Panel', {
fullscreen: true,
items: [
{
xtype: 'radiofield',
name : 'color',
value: 'red',
label: 'Red',
checked: true
},
{
xtype: 'radiofield',
name : 'color',
value: 'green',
label: 'Green'
},
{
xtype: 'radiofield',
name : 'color',
value: 'blue',
label: 'Blue'
}
]
});

Translucent tab bar in Sencha Touch 2

I was wondering what is the best way to make the tab bar translucent (iOS7 style) and have the content scroll underneath it. I am using a tab panel. Thoughts?
I tried setting tab bar to floating:true, but:
1. tabBar seems to be intended for private use and couldn't find floating property on it
2. On doing the following on the tab panel:
tabBar: {
floating: true
},
tabBarPosition: 'bottom'
I'm just getting the tab bar to be docked on top. Thoughts?
Thanks!
As of right now, you can't achieve translucence with CSS and dynamic content underneath. If it was a static image, you could do it.
You can approximate the effect with transparency. You basically need to use a container as your tab bar and style it with "position: absolute;" and set bottom: 0. The tab bar container shouldn't be an item of the list, rather an item of a container which also has the list.
Here's a quick example: https://fiddle.sencha.com/#fiddle/26i
Ext.application({
name : 'Fiddle',
launch : function() {
var toolbar = {
xtype: 'container',
bottom: 0,
alias: 'bottomtoolbar',
layout: 'hbox',
items: [
{
xtype: 'button',
text: 'Option 1',
style: 'background: transparent;',
iconAlign: 'top',
width: 80,
height: 60,
margin: '0 10 0 10'
},
{
xtype: 'button',
text: 'Option 2',
style: 'background: transparent;',
iconAlign: 'top',
width: 80,
height: 60,
margin: '0 10 0 10'
},
{
xtype: 'button',
text: 'Option 3',
style: 'background: transparent;',
iconAlign: 'top',
width: 80,
height: 60,
margin: '0 10 0 10'
}
],
width: '100%',
height: 80,
style: 'position: absolute; background: rgba(255,255,255,0.9);'
};
var list = {
xtype: 'list',
itemTpl: '{title}',
items: [
{
// Spacer so end of list is selectable
xtype: 'container',
height: 80,
scrollDock: 'bottom'
}
],
data: [
{ title: 'Item 1' },
{ title: 'Item 2' },
{ title: 'Item 3' },
{ title: 'Item 1' },
{ title: 'Item 2' },
{ title: 'Item 3' },
{ title: 'Item 1' },
{ title: 'Item 2' },
{ title: 'Item 3' },
{ title: 'Item 1' },
{ title: 'Item 2' },
{ title: 'Item 3' },
{ title: 'Item 1' },
{ title: 'Item 2' },
{ title: 'Item 3' },
{ title: 'Item 1' },
{ title: 'Item 2' },
{ title: 'Item 3' },
{ title: 'Item 1' },
{ title: 'Item 2' },
{ title: 'Item 3' },
{ title: 'Item 1' },
{ title: 'Item 2' },
{ title: 'Item 3' },
{ title: 'Item 1' },
{ title: 'Item 2' },
{ title: 'Item 3' },
{ title: 'Item 1' },
{ title: 'Item 2' },
{ title: 'Item 3' },
{ title: 'Item 2' },
{ title: 'Item 3' },
{ title: 'Item 1' },
{ title: 'Item 2' },
{ title: 'Item 3' },
{ title: 'Item 2' },
{ title: 'Item 3' },
{ title: 'Item 1' },
{ title: 'Item 2' },
{ title: 'Item 3' },
{ title: 'Item 4' }
]
};
Ext.Viewport.add(toolbar);
Ext.Viewport.add(list);
}
});
Granted, it's not styled very well, but you get the idea. Hope that helps.
Tabbar is docked by default to the bottom of the screen so even if you make it translucent all the content will be above it you will be unable to achieve what you wish. Instead you can set a bottom for the tab bar to position it below then add some opacity like .75 or .8 to try & get what you want

How to Increase Column Space in EXtJS Column Layout

i have designed an entry form as shown,
i need to have same space between test box and Middle name label.
My code is as follows,
var patientForm = new Ext.FormPanel({
layout: 'column',
columnWidth:1.5,
renderTo: "patientCreation",
frame: true,
autoScroll:true,
title: 'Create Patient',
bodyStyle: 'padding:9px',
width: 900,
items: [
{ xtype: 'textfield',
fieldLabel: 'FirstName',
name: 'firstName',
vtype : 'alpha',
allowBlank:false
},{
xtype: 'textfield',
fieldLabel: 'MiddleName',
name: 'middleName',
vtype : 'alpha'
},{
xtype: 'textfield',
fieldLabel: 'LastName',
name: 'lastName',
vtype : 'alpha',
allowBlank:false
},{
xtype: 'textfield',
fieldLabel: 'Email',
name: 'email',
vtype: 'email',
allowBlank:false
},
....
....
]
How to leave/increase space between text box and Middle name column?
If you know your number of columns, use column layout. Otherwise do this:
defaults: {
labelStyle: 'padding-left:10px;'
},
items: [...]
Add a defaults config to the container of the columns. All it's children will have the settings you define in defaults (docs). In this example there's just the margin setting (docs) in defaults that will be applied to each item/column.
Ext.create('Ext.panel.Panel', {
title: 'Column Layout - with default margins',
width: 350,
height: 250,
layout:'column',
defaults: {
margin: '0 15 0 0' //top right bottom left (clockwise) margins of each item/column
},
items: [{
title: 'Column 1',
columnWidth: 0.25
},{
title: 'Column 2',
columnWidth: 0.55
},{
title: 'Column 3',
columnWidth: 0.20
}],
renderTo: Ext.getBody()
});
The accepted solution works only with fields as columns. My solution works with any type of column.
PS: the column layout documentation is here.