form: {
labelLocation: "left",
items: [
{
dataField: "PART_CODE",
dataType: "string",//Accepted Values: undefined (Default) | 'string' | 'number' | 'date' | 'boolean' | 'object' | 'datetime'
visible: true,//Default Value: true
isRequired: true,//Default Value: undefined
editorType: "dxTextBox",//Accepted Values: 'dxAutocomplete' | 'dxCalendar' | 'dxCheckBox' | 'dxColorBox' | 'dxDateBox' | 'dxDropDownBox' | 'dxLookup' | 'dxNumberBox' | 'dxRadioGroup' | 'dxRangeSlider' | 'dxSelectBox' | 'dxSlider' | 'dxSwitch' | 'dxTagBox' | 'dxTextArea' | 'dxTextBox'
editorOptions: {
showClearButton: true,//Default Value: false
},
validationRules: [
{type: "required"},
{type: "stringLength", max: 10},
],
},
{},
{
dataField: "PNAME_CODE",
dataType: "string",//Accepted Values: undefined (Default) | 'string' | 'number' | 'date' | 'boolean' | 'object' | 'datetime'
visible: true,//Default Value: true
isRequired: true,//Default Value: undefined
editorType: "dxSelectBox",//Accepted Values: 'dxAutocomplete' | 'dxCalendar' | 'dxCheckBox' | 'dxColorBox' | 'dxDateBox' | 'dxDropDownBox' | 'dxLookup' | 'dxNumberBox' | 'dxRadioGroup' | 'dxRangeSlider' | 'dxSelectBox' | 'dxSlider' | 'dxSwitch' | 'dxTagBox' | 'dxTextArea' | 'dxTextBox'
editorOptions: {
showClearButton: true,//Default Value: false
onValueChanged: function (data) {
console.log(data.parent);
alert(data.value);
},
},
validationRules: [
{type: "required"},
],
},
{
dataField: "PART_NAME",
dataType: "string",//Accepted Values: undefined (Default) | 'string' | 'number' | 'date' | 'boolean' | 'object' | 'datetime'
visible: true,//Default Value: true
isRequired: true,//Default Value: undefined
editorType: "dxTextBox",//Accepted Values: 'dxAutocomplete' | 'dxCalendar' | 'dxCheckBox' | 'dxColorBox' | 'dxDateBox' | 'dxDropDownBox' | 'dxLookup' | 'dxNumberBox' | 'dxRadioGroup' | 'dxRangeSlider' | 'dxSelectBox' | 'dxSlider' | 'dxSwitch' | 'dxTagBox' | 'dxTextArea' | 'dxTextBox'
editorOptions: {
showClearButton: true,//Default Value: false
},
validationRules: [
{type: "required"},
{type: "stringLength", max: 50},
],
},
{
dataField: "PART_BIGO",
dataType: "string",//Accepted Values: undefined (Default) | 'string' | 'number' | 'date' | 'boolean' | 'object' | 'datetime'
visible: true,//Default Value: true
isRequired: false,//Default Value: undefined
editorType: "dxTextArea",//Accepted Values: 'dxAutocomplete' | 'dxCalendar' | 'dxCheckBox' | 'dxColorBox' | 'dxDateBox' | 'dxDropDownBox' | 'dxLookup' | 'dxNumberBox' | 'dxRadioGroup' | 'dxRangeSlider' | 'dxSelectBox' | 'dxSlider' | 'dxSwitch' | 'dxTagBox' | 'dxTextArea' | 'dxTextBox'
editorOptions: {
showClearButton: true,//Default Value: false
height: 80,
},
validationRules: [
{type: "stringLength", max: 500},
],
},
{},
{
id: "testGrid",
editorType: "dxDataGrid",
editorOptions: {
height : "390px",
dataSource: test,
columns: [
{
caption: "파트코드",
dataField: "PART_CODE",
dataType: "string",//Accepted Values: undefined (Default) | 'string' | 'number' | 'date' | 'boolean' | 'object' | 'datetime'
visible: true,//Default Value: true
},
{
caption: "품명",
dataField: "PROD_NAME",
// dataField: "PNAME_NAME",
dataType: "string",//Accepted Values: undefined (Default) | 'string' | 'number' | 'date' | 'boolean' | 'object' | 'datetime'
visible: true,//Default Value: true
},
{
caption: "파트명",
dataField: "PART_NAME",
dataType: "string",//Accepted Values: undefined (Default) | 'string' | 'number' | 'date' | 'boolean' | 'object' | 'datetime'
visible: true,//Default Value: true
},
{
caption: "비고",
dataField: "PART_BIGO",
dataType: "string",//Accepted Values: undefined (Default) | 'string' | 'number' | 'date' | 'boolean' | 'object' | 'datetime'
visible: true,//Default Value: true
},
],
sorting: {
mode: "multiple"
},
allowColumnReordering: true,
allowColumnResizing: true,
columnAutoWidth: true,
groupPanel: {
visible: true
},
selection: {
mode: "single"
}
},
},
],
},
When I change dxSelectBox selection, refresh the 'editorType: dxDataGrid'
The dxDataGrid dataSource must change on dxSelectBox. so I try it
The test was CustomStore, it works.
I want use other declared popup, but I can't use that use editing
If impossible to refresh, I want find other way..
Is it possible to refresh in test ajax success function?
How can I do?
This is how I reload my .NET MVC datagrid using JQuery.
You can use any event but I call it using this one:
.OnRowUpdated("reloadMainDataGrid")
With this function in JQuery:
function reloadMainDataGrid() {
$("#MainDataGrid").dxDataGrid("getDataSource").reload();
}
I hope that helps guide you to the right answer if nothing else.
Related
import React, { useState } from 'react';
import 'antd/dist/antd.css';
import { Select, Button } from 'antd';
import { Pie } from '#ant-design/plots';
export default function App() {
const [selectedInputValue, setSelectValue] = useState('lucy');
const [pieChartData, setPieChartData] = useState([
{ type: 'lucy-1', value: 12 },
{ type: 'lucy-2', value: 13 },
{ type: 'lucy-4', value: 2 },
{ type: 'lucy-3', value: 6 },
]);
const config = {
appendPadding: 10,
data: pieChartData,
angleField: 'value',
colorField: 'type',
radius: 0.75,
label: {
type: 'spider',
labelHeight: 28,
content: '{name}\n{percentage}',
},
legend: {
display: true,
},
interactions: [
{
type: 'element-selected',
},
{
type: 'element-active',
},
],
onReady: (plot) => {
plot.on('element:click', (...args) => {
console.log(selectedInputValue);
updateChartValue();
});
},
};
const updateChartValue = () => {
if (selectedInputValue === 'lucy') {
const data = [
{ type: 'lucy-1', value: 12 },
{ type: 'lucy-2', value: 13 },
{ type: 'lucy-4', value: 2 },
{ type: 'lucy-3', value: 6 },
];
setPieChartData(data);
} else if (selectedInputValue === 'jack') {
const data = [
{ type: 'jack-1', value: 12 },
{ type: 'jack-2', value: 13 },
{ type: 'jack-4', value: 2 },
{ type: 'jack-3', value: 6 },
];
setPieChartData(data);
} else if (selectedInputValue === 'Yiminghe') {
const data = [
{ type: 'Yiminghe-1', value: 12 },
{ type: 'Yiminghe-2', value: 13 },
{ type: 'Yiminghe-4', value: 2 },
{ type: 'Yiminghe-3', value: 6 },
];
setPieChartData(data);
} else {
const data = [
{ type: 'dummy-1', value: 12 },
{ type: 'dummy-2', value: 13 },
{ type: 'dummy-4', value: 2 },
{ type: 'dummy-3', value: 6 },
];
setPieChartData(data);
}
};
const handleChange = (value) => {
setSelectValue(value);
sdddd = value;
};
return (
<div id="chart">
<Select
value={selectedInputValue}
style={{
width: 120,
marginLeft: '12px',
marginTop: '12px',
}}
onChange={handleChange}
>
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
<Option value="Yiminghe">yiminghe</Option>
<Option value="Dummy">Dummy</Option>
</Select>
<Pie {...config} />
<Button onClick={updateChartValue}>Load Data </Button>
</div>
);
}
The variable pieChartData should get loaded based on selectedInputValue when performing the plot.on("element:click") event. But, On the pie chart element click, the state variable selectedInputValue holds the initialized value only.
Other places outside the events of the charts are all able to access the new updated value for selectedInputValue.
Any thoughts on this?
I am attempting to switch to using the urql offlineExchange.
Getting the following error:
<!-- language: lang-none -->
TypeError: Cannot read property 'length' of undefined
ha
https://rdududevw10sdn.dsa.int:3443/static/js/0.chunk.js:23933:10
Module../src/index.js
E:/CCase/sdickerson_wfm14216_view/AnsosWeb/WSM/Application/app/src/index.js:33
30 | optimistic: {},
31 | });
32 |
> 33 | const client = createClient({
34 | url: WSM_URL,
35 | exchanges: [dedupExchange, cache, fetchExchange],
36 | })
I'm attempting to follow the Offline Support documentation (Offline Support.
index.js:
const WSM_URL = '/api/gql'
const introspectedSchema = {
__schema: {
queryType: {name: 'Query',},
mutationType: {name: 'Mutation',},
subscriptionType: {name: 'Subscription',},
},
}
const storage = makeDefaultStorage({
idbName: 'graphcache-v3', // The name of the IndexedDB database
maxAge: 7, // The maximum age of the persisted data in days
})
const cache = offlineExchange({
schema: introspectedSchema,
storage,
updates: {},
optimistic: {},
});
const client = createClient({
url: WSM_URL,
exchanges: [dedupExchange, cache, fetchExchange],
})
I am trying to partially match the object which are being passed to TitleRepo.find. I am not able to understand what wrong I am doing.
expect(jest.fn()).toBeCalledWith(...expected)
Expected: ObjectContaining {"filter": {"limit": Any<Number>}}
Received: {"filter": {"title_ids.xxx.deleted_at": null, "title_ids.xxx.deleted_at": null, "title_ids.xxx.id": {"$exists": true, "$ne": null}}, "limit": 10, "sort": {"created_at": -1}}
Number of calls: 1
31 | });
32 |
> 33 | expect(TitleRepo.find).toBeCalledWith(
| ^
34 | expect.objectContaining({"filter": {"limit": expect.any(Number)}}),
35 | );
36 | })
at Object.<anonymous> (tests/query/TitleQuery.test.js:33:32)
Related lines from test is.
TitleRepo.find = jest.fn();
it('should able to set platform correctly', async () => {
const titles = await TitleQuery.find({
platform: 'chandu'
});
expect(TitleRepo.find).toBeCalledWith(
expect.objectContaining({"filter": {"limit": expect.any(Number)}}),
);
})
limit property is on the same level as filter.
It should be:
expect(TitleRepo.find).toBeCalledWith(expect.objectContaining({ limit: expect.any(Number) })
I have a kendo pivot grid defined in this way:
<div kendo-pivot-grid
id="pivotGrid"
k-excel="{ fileName: reportCtrl.CurrentReport.DS_REPORT + '.xlsx' }"
k-height="'100%'"
k-sortable="true"
k-filterable="true"
k-row-header-template="'#= rowTemplate #'"
kx-data="resultCtrl.ReportResult"
kx-data-source-options="{
data: resultCtrl.ReportResult,
schema: {
fields: {
DT_MEASURE: { type: 'shortDate' }
},
cube: {
dimensions: {
ID_MEASURE_A: { caption: 'Measure A' },
ID_MEASURE_B: { caption: 'Measure B' },
},
measures: {
'AverageA': { field: 'ID_MEASURE_A', aggregate: 'average' },
'AverageB': { field: 'ID_MEASURE_B', aggregate: 'average' }
}
},
},
columns: [
{ name: 'ID_PRODUCT', expand: true }
],
rows: [
{ name: 'DT_MEASURE', expand: true },
],
measures: ['AverageA', 'AverageB']
}"
kx-vertical-stretch="true">
</div>
And here the script rowTemplate:
<script id="rowTemplate" type="text/x-kendo-template">
# if (member.name.indexOf("DT_MEASURE") === 0 && member.name !== "DT_MEASURE") { #
#: kendo.toString(kendo.parseDate(member.caption), "dd-MM-yyyy") #
# } else { #
#: member.caption.toString() #
# } #
</script>
I want to define my rowHeaderTemplate to show the correct format of a date but every attempt to do it doesn't work.
Any suggestion?
I have an app that allows management of orders. The default view is a split view with orders on the left and selected order details on the right like so:
/Orders /Orders/:order_id
|-----------| |-------------------------------------|
| | | |
| | | |
| | | |
| | | |
| | | |
| List of | | Selected Item |
| Items | | Details |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
|-----------| |-------------------------------------|
I'd like to be able to edit an order in "full-screen" mode so that the URL and template looks like this:
/Orders/:order_id/edit/
|---------------------------------------------------|
| |
| |
| |
| |
| |
| |
| Order Edit Interface |
| |
| |
| |
| |
| |
| |
| |
|---------------------------------------------------|
My routes are currently setup as follows:
this.resource('Orders.edit', { path: 'Orders/:order_id/edit' } , function () {
this.route('customer-details');
this.route('vendor-details');
this.route('shipping-details');
}
this.resource('Orders', { path: 'Orders' }, function () {
this.resource('Order', { path: ':order_id' }, function () {
this.route('customer-details');
this.route('vendor-details');
this.route('shipping-details');
}
}
And my order routes look like this:
// Orders Route
App.OrdersRoute = Em.Route.extend({
model: function() {
return this.store.find('order');
},
afterModel: function (orders) {
this.transitionTo('orders.order', orders.get('firstObject') );
}
});
// Order Detail
App.OrdersOrderRoute = Em.Route.extend({
model: function(params) {
return this.store.find('order', params.order);
},
setupController: function (controller, model) {
controller.set('content', model);
}
});
// Order Edit Route
App.OrdersEditRoute = Em.Route.extend({
model: function(params) {
if (typeof params.order_id !== 'undefined') {
this.store.find('order', params.order_id).then(function (order) {
this.controllerFor('orders.edit').set('content', order);
});
} else if (typeof params.order !== 'undefined') {
this.store.find('order', params.order).then(function (order) {
this.controllerFor('orders.edit').set('content', order);
});
}
},
afterModel: function(eo) {
this.transitionTo('orders.edit.customer-details', order);
}
});
// Order Edit - Customer Details Route
App.OrdersEditCustomerDetailsRoute = Em.Route.extend({
model: function() {
try {
var order = this.get('order');
return order;
} catch (e) {
console.log('ERROR: ' + e);
}
},
beforeModel: function() {
this.set('order', this.modelFor('orders.edit'));
},
});
This setup works if I'm in the Orders/:order_id route/template and click the edit button which then sends me to Orders/:order_id/edit with the desired interface and data loaded. But if I try to refresh Orders/:order_id/edit in the browser window nothing loads and I get the following errors. I also don't hit any breakpoints set inside of the Orders/:order_id/edit route when accessing the URL this way.
Uncaught Error: Assertion Failed: Cannot delegate set('classification', N/A) to the 'content' property of object proxy <Synapse.EngineeringOrdersEditDetailsController:ember1242>: its 'content' is undefined. libs.js:2870
Ember.assert libs.js:2870
EmberObject.extend.setUnknownProperty libs.js:23933
set libs.js:9229
setPath libs.js:9289
set libs.js:9209
trySet libs.js:9306
(anonymous function) libs.js:3416
tryable libs.js:5964
tryFinally libs.js:10524
suspendListener libs.js:5967
_suspendObserver libs.js:8311
Binding._sync libs.js:3415
DeferredActionQueues.invoke libs.js:11346
DeferredActionQueues.flush libs.js:11398
Backburner.end libs.js:10861
Backburner.run libs.js:10916
apply libs.js:10745
run libs.js:9378
runInitialize libs.js:45596
n.Callbacks.j libs.js:2
n.Callbacks.k.fireWith libs.js:2
n.extend.ready libs.js:2
I libs.js:2
TypeError: undefined is not a function
at http://localhost:1337/js/app.js:27936:22
at invokeCallback (http://localhost:1337/js/libs.js:13310:19)
at publish (http://localhost:1337/js/libs.js:12980:9)
at publishFulfillment (http://localhost:1337/js/libs.js:13400:7)
at http://localhost:1337/js/libs.js:18818:9
at DeferredActionQueues.invoke (http://localhost:1337/js/libs.js:11348:18)
at Object.DeferredActionQueues.flush (http://localhost:1337/js/libs.js:11398:15)
at Object.Backburner.end (http://localhost:1337/js/libs.js:10861:27)
at Object.Backburner.run (http://localhost:1337/js/libs.js:10916:20)
at executeTimers (http://localhost:1337/js/libs.js:11241:12) libs.js:6663
logToConsole libs.js:6663
RSVP.onerrorDefault libs.js:49435
__exports__.default.trigger libs.js:12274
Promise._onerror libs.js:12998
publishRejection libs.js:13405
(anonymous function) libs.js:18818
DeferredActionQueues.invoke libs.js:11348
DeferredActionQueues.flush libs.js:11398
Backburner.end libs.js:10861
Backburner.run libs.js:10916
executeTimers libs.js:11241
(anonymous function) libs.js:11231
Uncaught Error: Assertion Failed: TypeError: undefined is not a function libs.js:2870
Ember.assert libs.js:2870
RSVP.onerrorDefault libs.js:49436
__exports__.default.trigger libs.js:12274
Promise._onerror libs.js:12998
publishRejection libs.js:13405
(anonymous function) libs.js:18818
DeferredActionQueues.invoke libs.js:11348
DeferredActionQueues.flush libs.js:11398
Backburner.end libs.js:10861
Backburner.run libs.js:10916
executeTimers libs.js:11241
(anonymous function)
I suspect it has something to do with having the Orders/order/edit route outside the hierarchy of the Orders resource but I was unable to get the outlets to play nicely to render the desired interface.
TLDR - How do I get the Orders/:order_id/edit to load the model properly from the URL slug? Using Ember 1.6.1 and Ember-data Fixture Adapter
Two approaches to achieve what you describe are,
Separate resource for editing (basically along the lines if what you've tried)
Nested resource and maintain a property based on which the template will only render the outlet part or not.
Example of these two approaches,
http://emberjs.jsbin.com/wupiwoculoxi/1/edit
hbs
<script type="text/x-handlebars" id="orders">
{{#unless showOnlyEditDetail}}
orders
<br/>
{{#each order in model}}
{{#link-to "order" order.id}}
{{order.name}}
{{/link-to}}
<br/> <br/>
{{/each}}
{{/unless}}
{{!--the following lines before the outlet are shown on purpose for demonstration reasons, the unless helper in this example can hide anything on this template--}}
<hr/>
<i>the value of showOnlyEditDetail:</i><b>{{showOnlyEditDetail}}</b>
<hr/>
{{outlet}}
</script>
<script type="text/x-handlebars" id="order">
the order
<br/>
<br/>
{{this.id}}
<br/>
<br/>
{{this.name}}
<br/>
<br/>
{{#link-to "orderEdit" this.id }}edit1{{/link-to}}
<i>(separate resource)</i>
<br/>
<br/>
{{#link-to "orderEdit2" this.id }}edit2{{/link-to}}
<i>(nested resource and maintaining property)</i>
</script>
<script type="text/x-handlebars" id="orderEdit">
edit the order
<br/>
{{this.id}}
<br/>
{{this.name}}
<br/>
{{#link-to "order" this.id}}back to the order{{/link-to}}
</script>
<script type="text/x-handlebars" id="orderEdit2">
edit2 the order
<br/>
{{this.id}}
<br/>
{{this.name}}
<br/>
{{#link-to "order" this.id}}back to the order{{/link-to}}
</script>
js
App = Ember.Application.create();
App.Router.map(function() {
this.resource("orderEdit",{path:"orders/:order_id/edit"}, function(){
});
this.resource('orders', { path: 'orders' }, function () {
this.resource('order', { path: ':order_id' }, function () {
this.route('customer-details');
this.route('vendor-details');
this.route('shipping-details');
});
this.resource("orderEdit2",{path:":order_id/edit2"}, function(){});
});
});
App.IndexRoute = Ember.Route.extend({
redirect: function() {
this.transitionTo("orders");
}
});
var ordersData=[
{id:1,name:"order1"},
{id:2,name:"order2"},
{id:3,name:"order3"}
];
App.OrdersRoute = Ember.Route.extend({
model: function() {
return ordersData;
},
setupController:function(c,m){
c.set("showOnlyEditDetail",false);
this._super(c,m);
}
});
/*if the second approach is used then the controller with the specific property
(i.e. showOnlyEditDetail) must be defined.*/
App.OrdersController=Em.ArrayController.extend({
showOnlyEditDetail:false
});
App.OrderRoute = Ember.Route.extend({
model: function(params) {
return ordersData.findBy("id",parseInt(params.order_id,10));
}
});
App.OrderEditRoute = Ember.Route.extend({
model: function(params) {
return ordersData.findBy("id",parseInt(params.order_id,10));
}
});
App.OrderEdit2Route = Ember.Route.extend({
model: function(params) {
return ordersData.findBy("id",parseInt(params.order_id,10));
},
setupController:function(c,m){
this._super(c,m);
this.controllerFor("orders").set("showOnlyEditDetail",true);
},
actions:{
willTransition:function(){
this.controllerFor("orders").set("showOnlyEditDetail",false);
}
}
});