I'm trying to show some data that is grouped using ag-grid. The data is being displayed correctly, but it is not grouping the data as it should. I'm using angularJS 1.5.8 and ag-grid 12.0.2. Here is a very simplified version of what I'm trying to do:
function _setGridOptions() {
var data = [
{packageID: "one", documentID: "one-one", cost: 1},
{packageID: "one", documentID: "one-two", cost: 2},
{packageID: "one", documentID: "one-three", cost: 3},
{packageID: "two", documentID: "two-one", cost: 4},
{packageID: "two", documentID: "two-two", cost: 5},
{packageID: "two", documentID: "two-three", cost: 6}
];
var cols = [
{
headerName: "Package ID",
width: 100,
field: "packageID",
rowGroup: true
},
{
headerName: "Document ID",
width: 100,
field: "documentID"
},
{
headerName: "Cost",
width: 100,
field: "cost"
}
];
$ctrl.agGridOptions = {
columnDefs: cols,
animateRows: true,
enableRangeSelection: true,
rowData: data,
enableSorting: true,
debug: true,
enableColResize: true,
onGridReady: function () {
$ctrl.agGridOptions.api.sizeColumnsToFit();
}
};
$ctrl.transactionsLoaded = true;
}
And here is what the table looks like:
As you can see there is no "Group" column and there is no expand/collapse control by the group row.
Any ideas what I'm doing wrong?
I just realized what the issue is. The "Grouping Rows" feature is an enterprise feature and I am using the free version.
Actually it is not an Enterprise feature, but it is a free version feature that everyone can use this. Even tree-data feature is can be used with free version how ever only some of extra features are under Enterprise version of Ag-grid. Maybe in the date of question, Row Grouping was available for Enterprise version, I don't know. Now, it is free all.
Although the question is very historical for our field, I will share an answer because of those who are in need to use row grouping Ag-grid in any version.
Actually, your data and your gridOptions definition is quite enough to enable row grouping, to be clear, however the version of Ag-grid you used was very older. If someone take your data and use newer version of Ag-grid, he/she can see that you data is providing the requirement of row grouping.
In short, to applying a row grouping, it is sufficient to declare rowGroup: true in the definition of the column which we want to apply.
gridOptions.columnDefs = [
{ field: "country", rowGroup: true },
{ field: "sport", rowGroup: true },
];
And the data is:
rowData= [
{ 'country': 'United States', 'sport': 'Biking' },
{ 'country': 'United States', 'sport': 'Swimming', },
{ 'country': 'United States', 'sport': 'Swimming' }
{ 'country': 'Turkey', 'sport': 'Swimming', },
{ 'country': 'Turkey', 'sport': 'Swimming' }
{ 'country': 'Brasil', 'sport': 'Football' }
]
More detail, see page: ag-grid.com/javascript-grid-grouping
Related
I'm using Apollo Client 3 in a react project.
I have a data structure like this:
ROOT_QUERY
getCollection {
__typename: 'Collection',
_id: '123'
tagColorMap: [
{__typename: 'Tag',
name: 'tag1',
color: "#673ab7",
count: 3},
{__typename: 'Tag',
name: 'tag2',
color: '#f44336',
count: 1},
...
]
entries: [
{
__typename: 'Entry',
_id: 'asd'
tags: [tag1, tag2, tag3]
},
{
__typename: 'Entry',
_id: 'qwe'
tags: [tag2, tag3]
},
...
}
}
the data are normalised in the cache.
ROOT_QUERY
getCollection{
"__ref": "Collection:123"
}
Collection:123{
_id: '123'
tagColorMap: [
{__typename: "Tag",
name: "tag1",
color: "#673ab7",
count: 3},
{__typename: "Tag",
name: "tag2",
color: "#f44336",
count: 1},
...
]
entries: [
{
__ref: "Entry:asd"
},
{
__ref: "Entry:qwe"
},
...
]
Entry:asd {
_id: 'asd'
tags: ['tag1', 'tag2', 'tag3']
},
Entry:qwe {
_id: 'qwe'
tags: ['tag2', 'tag3']
},
I performed a mutation, which renames one of the tag, say 'tag1' -> 'tag11', which returns the new tagColorMap;
now I want to change all 'tag1' into 'tag11' in the cache.
I have gone through the official doc and googled it for a while, but still can't find a way to do this.
refetching won't work because the time between the mutation is done and the refetch is done, all the entries that still have tag 'tag1' don't have a corresponding colour in the colour map, it will fallback to default colour, then back to the original colour after the refetch is done.
another way might be that to let the server return the entire collection after the mutation, which is quite a lot of data
so that's why I would like to rename all 'tag1' into 'tag11' in all 'entry" objects directly in cache, but I couldn't find a way to do this... Could anyone help me with this?
thank you very much in advance!
I'm using the new 2019 paypal sdk with React and I'm trying to create an order with 2 line items. When I create an order, I'm able to get the correct total inside paypal and complete a transaction, but on the test users receipt, it just shows the total for 25.99 and no line items. I'm following v2 of their api instructions but no items are showing up.
purchase_units: [{
amount: {
currency_code: 'USD',
value: '25.99',
breakdown: {
item_total: { value: '25.99', currency_code: 'USD' }
}
}
}],
items: [
{
name: 'Watercolor texture kit Vol. 1',
unit_amount: {
value: '16.00',
currency_code: 'USD'
},
quantity: '1',
description: 'test desc',
sku: '222'
},
{
name: 'Skinny jeans',
unit_amount: {
currency_code: 'USD',
value: '9.99'
},
quantity: '1',
description: 'test desc',
sku: '30'
}
],
I know this is old, I had a similar problem. I think the items need to be inside the purchase_units. I also found to work that I need to include the descriptors in quotes - the API docs don't specify this though.
This is what I'm using to make it work:
<script id='paypal-js' src={`https://www.paypal.com/sdk/js?client-id=${PaypalKey}&disable-funding=credit,card&commit=true&merchant-id=${PaypalMerchantId}&locale=en_US&integration-date=2019-11-07`}/>
Integration date makes paypal use different versions of the api depending on the date.
purchase_units: [{
amount: {
currency_code: currency,
value: cart.totalPrice,
breakdown: {
item_total: {
value: cart.totalPrice,
currency_code: currency
}
}
},
invoice_id: Math.random().toString(36).substring(14),
items: getPaypalFormatItems(cart, products),
soft_descriptor: 'Digital Purchase', // appears on CC statement
description: 'Paypal payment'
}],
application_context: {
brand_name: 'Every-Tuesday',
shipping_preference: 'NO_SHIPPING',
user_action: 'PAY_NOW'
}
Does angular gantt plugin allow to change the column header labels? I tried to change the side table headers but couldn't. If it doesn't allow what other gantt chart can I use? At the side table, I need to show work station, id and type. In the gannt chart, I need to show the particular ids under the respective priority numbers. Any suggestions, please?
You can change or defined the column header labels at property Options.
$scope.options = {
...
treeTableColumns: ['from', 'to', 'myColumn'],
columnsHeaders: { 'model.name': 'Name', 'from': 'From', 'to': 'To', 'myColumn': 'My column name' },
columnsClasses: { //css
'myColumn': 'myclass'
},
//defined content here. ex: String, checkbox, radio, ...
//ex: <input type="checkbox" id={{row.model.id}} ng-model="row.model.myColumn">
columnsContents: {
'myColumn': '{{row.model.myColumn}}',
...
},
};
$scope.myData = [{
id: 1,
name: 'Finalize concept',
myColumn: 'content',
tasks: [{
id: 'Finalize concept',
name: 'Finalize concept',
priority: 10,
color: '#F1C232',
from: new Date(2013, 9, 17, 8, 0, 0),
to: new Date(2013, 9, 18, 18, 0, 0),
progress: 100
}]
}, {
id: 2,
name: 'Development',
myColumn: 'content',
children: ['Sprint 1', 'Sprint 2', 'Sprint 3', 'Sprint 4'],
content: '<i class="fa fa-file-code-o" ng-click="scope.handleRowIconClick(row.model)"></i> {{row.model.name}}'
} ]
https://www.angular-gantt.com/configuration/attributes/
Here yo have the answer about all you can do.
You cant change the column header labels but you can select between all the formats that you have:
$scope.headersFormats = {
'year': 'YYYY',
'quarter': '[Q]Q YYYY',
month: 'MMMM YYYY',
week: 'w',
day: 'D',
hour: 'H',
minute:'HH:mm'
};
i have 2 select boxes,which is getting the data using ng-options and hardcoded.
the second select box should show the data based on the selected data in first selectbox. this is the plunker.
https://plnkr.co/edit/r1S1e61H3RfH3uYGYTBP?p=preview
can anyone please help me.
$scope.data = [{
cities: [{
id: 1,
title: 'Mysore'
}, {
id: 2,
title: 'Bangalore'
}, {
id: 3,
title: 'Delhi'
}, {
id: 4,
title: 'Mumbai'
}],
maps: [{
id: 1,
title: 'Zoo',
city_id: 1
}, {
id: 2,
title: 'Palace',
city_id: 1
}, {
id: 3,
title: 'Beach',
city_id: 4
}]
}];
You can pass the selected city's id from 1st drop down as a filter to 2nd drop down like below
<select name="mapSelect" required="true" ng-options="map as map.title for map in data[0].maps | filter:{'city_id':citySelect.selectedOption.id}" ng-model="mapSelect.selectedOption"></select>
I'm trying to add some icons inline to the TreeView data items, however the k-template directive does not seem to be rendering anything.
I base this off of the online docs at
http://demos.telerik.com/kendo-ui/treeview/angular
and here's a plunkr of what I'm trying to do:
treeview plunkr
My HTML (with a simple test)
<div id="treeview" kendo-tree-view="nav.treeview"
k-options="nav.treeOptions"
k-data-source="nav.reportsTreeDataSource"
k-on-change="nav.onTreeSelect(dataItem)">
<span k-template>{{dataItem.text}} TEST THIS TEMPLATE !!!</span>
</div>
and here's a snippet of my dataSource coming from my datacontext service:
function getReportsTree() {
var reportsJson = [
{
id: 1, text: "Standard", expanded: false, spriteCssClass: "rootfolder", checkChildren: true, items: [
{ id: 3, text: "MTM Aggr", reptName: "MTM Aggr", spriteCssClass: "folder" },
{ id: 4, text: "Member Aggr", reptName: "Member Aggr", spriteCssClass: "folder" }
]
},
{
id: 30, text: "Hierarchy", expanded: false, spriteCssClass: "rootfolder", checkChildren: true, items: [
{ id: 31, text: "Ctpy Hrchy", reptName: "CTPYHIER", withHierarchy: 'true' },
{ id: 32, text: "Ctpy/BkgLocation Hrchy", reptName: "CTPYHIER_BKG_LOC", withHierarchy: 'true' }
]
}
];
return $q.when(reportsJson);
}
Image showing the rendered tree, where the template does NOT render :
I need to know if I'm missing some key piece here, or do I have incorrect formatting.
thank you in advance,
Bob
**** UPDATE ****
I'm now checking to see if my Kendo UI library is a few versions behind. It may have something to do with my issue.
A Kendo UI lib update to 2014.3.1308 was necessary to get the k-template option embedded into the treeview.
However I do find a minor bug, even on their demo website - when you expand a tree node, that same level's text becomes the literal {{dataItem}}.