No data being returned from syncfusion querybuilder - syncfusion

I have a dataset that I want to build a query tool for so not being a web developer I turned to Syncfusion's QueryBuilder.
Using the exact code displayed here in their tutorial of local data for the App.vue and datasource.js. I made my webpage, when when entering conditions no data is returned to me. How can I get the data to be return when querying it?

We have checked your reported query. We have prepared Querybuilder sample using local data as demonstrated in the below code snippet.
App.vue
<template>
<div class="control-section">
<div class="col-lg-12 querybuilder-control">
<ejs-querybuilder
width="70%"
:rule="importRules"
:dataSource="dataSource"
>
</ejs-querybuilder>
</div>
</div>
</template>
<script>
import Vue from "vue";
import {
QueryBuilderPlugin,
dataSource,
} from "#syncfusion/ej2-vue-querybuilder";
Vue.use(QueryBuilderPlugin);
import { employeeData } from "/src/dataSource.js";
export default {
data: function () {
return {
dataSource: employeeData,
values: ["Mr.", "Mrs."],
importRules: {
condition: "and",
rules: [
{
label: "Employee ID",
field: "EmployeeID",
type: "number",
operator: "equal",
value: 1,
},
{
label: "Title",
field: "Title",
type: "string",
operator: "equal",
value: "Sales Manager",
},
],
},
};
},
};
</script>
For your reference, we have prepared a sample based on your requirement. Please check the below sample.
Sample: https://codesandbox.io/s/vue-template-forked-g62vv?file=/src/App.vue

Related

tinymce removed breaks in codesample plugin

I am working on a project where I using tinymce with the codesample plugin.
When I am set up some code in the codesample every thing is fine but after I saved this code in the database and goes to the view page every thing is in one row. It looks like that all the breaks are removed.
I'm doing this project in Asp.net core mvc entity framework.
<script>
tinymce.init({
selector: '#ArtikelInhoud',
plugins: "code",
plugins: 'codesample',
codesample_languages: [
{ text: 'HTML/XML', value: 'markup' },
{ text: 'JavaScript', value: 'javascript' },
{ text: 'CSS', value: 'css' },
{ text: 'PHP', value: 'php' },
{ text: 'Ruby', value: 'ruby' },
{ text: 'Python', value: 'python' },
{ text: 'Java', value: 'java' },
{ text: 'C', value: 'c' },
{ text: 'C#', value: 'csharp' },
{ text: 'C++', value: 'cpp' }
],
remove_linebreaks: false,
convert_newlines_to_br: true,
force_br_newlines: true
});
</script>
When you render content created with the codesample plugin you need to include some code from Prism when you do so. This is documented on the codesample plugin page:
https://www.tiny.cloud/docs/plugins/codesample/#usingprismjsonyourwebpage
You need to add prism.js and prism.css to your page in order to get
the syntax highlighted code samples on your webpage (as created by the
Code Sample plugin). The Code Sample plugin uses the following
languages: markup, javascript, css, php, ruby, python, java, c, csharp
and cpp. You can generate the prism.js and prism.css files on the
download page at the Prism website.
I did not successfully reproduce your problem, the following is a successful example, you can refer to it.
(I hope you can provide the complete code, tell us how you submitted the data, and the corresponding js and css references.)
Data class:
public class Data
{
public string Content{ get; set; }
}
controller:
public IActionResult Test()
{
return View();
}
[HttpPost]
public IActionResult Test(Data data)
{
//save the content in data.Content to database
return View(data);
}
View:
#model WebApplication_core_mvc.Models.Data
#{
ViewData["Title"] = "Test";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h1>Test</h1>
#section Scripts{
<script src="https://cloud.tinymce.com/stable/tinymce.min.js?apiKey=qagffr3pkuv17a8on1afax661irst1hbr4e6tbv888sz91jc" referrerpolicy="origin"></script>
<script>
tinymce.init({
selector: '#ArtikelInhoud',
plugins: "code",
plugins: 'codesample',
codesample_languages: [
{ text: 'HTML/XML', value: 'markup' },
{ text: 'JavaScript', value: 'javascript' },
{ text: 'CSS', value: 'css' },
{ text: 'PHP', value: 'php' },
{ text: 'Ruby', value: 'ruby' },
{ text: 'Python', value: 'python' },
{ text: 'Java', value: 'java' },
{ text: 'C', value: 'c' },
{ text: 'C#', value: 'csharp' },
{ text: 'C++', value: 'cpp' }
],
remove_linebreaks: false,
convert_newlines_to_br: true,
force_br_newlines: true
});
</script>
}
<form asp-action="Test" method="post">
<textarea id="ArtikelInhoud" asp-for="Content">
</textarea>
<input id="Button1" type="submit" value="button" class="btn btn-primary" />
</form>
Here is the result:

Connecting Vue.js Frontend -> through Express, Node.js, Sequelize (API) endpoints. (PostgreSQL)

I have worked through various tutorials to understand and implement the Api Calls (Endpoints), defining Getters, almost to the point where I can fully invoke CRUD operations through routes pointing to them accordingly.
I can create Foreign Keys through sequelize, which creates my PostgreSQL table perfectly
async showAll (req, res) {
try {
const products = await Product.findAll({
where: {}
})
res.send(products)
} catch (err) {
res.status(500).send({
error: 'An Error has occured trying to retrieve Products'
})
}
},
In Postman
When hitting my endpoint GET /principals
All the relevant products are also displayed
{
"id": 2,
"name": "Company B",
"telephoneNumber": "012 111 1111",
"address": "Betha Str\nBedrasDorp",
"logo": "",
"registrationNumber": "2020/123/1234",
"taxNumber": "123",
"monthEnd": 1,
"createdAt": "2020-01-31T09:29:39.692Z",
"updatedAt": "2020-01-31T09:29:39.692Z",
"products": [
{
"id": 18,
"stockCode": "U7U5U",
"nappiCode": "NULL",
"barCode": "NULL",
"description": "Silver",
"sysPrice": 297.43,
"image": "",
"createdAt": "2020-01-31T09:25:22.620Z",
"updatedAt": "2020-01-31T09:25:22.620Z",
"principalId": 2
},
My question
How do I display my Principal Name in a Vue component and not just the principalID as per sequelize created column on my postgreSQL DB.
My current section within products.vue
<script>
....
async mounted () {
// do request to list all products
this.products = (await ProductsService.showAll()).data
}
...
</script>
displaying the productId
....
<template
slot="items"
slot-scope="{ item }">
<td>{{ item.stockCode }}</td>
<td>{{ item.description }}</td>
<td class="text-xs-left"> {{ item.principalId }} </td>
</template>
...
How can I display the Principal - name from a foreign key constraint? Linked in my PostgreSQL table in the Vue component.
Please help!
I managed to sort it out.
You controller section should include.
async showAll (req, res) {
try {
const products = await Product.findAll({
where: {},
include: [
{
model: ParentName
}
]
})
res.send(products)
} catch (err) {
res.status(500).send({
error: 'An Error has occured trying to retrieve Products'
})
}
}
Your .vue component Script section
async mounted () {this.products = (await ProductsService.showAll()).data
}
And calling it in the Template Component within vue becomes easy
{{ props.item.Principal.name }}

Yadcf integrate with Meteor simple schema

I want to filter column header data from my tabular table.
My goal is to filter:
Numbers (greater than, equal etc...)
Strings
Dates
as in the following example
Thus I want to integrate the filters of yadcf with my tabular table by using the Orion schema, by I can´t conclude,
FIRST OPTION WITH SCHEMA
Mi schema
Tickets = new orion.collection('tickets', {
singularName: 'Tickets',
pluralName: 'Tickets',
title: 'Tickets',
parentPath: '/admin',
link: {title: 'Tickets', parent: '_template'},
tabular: {
scrollX: true,
"processing": true,
dom: 'lBfrtip',
columns: [
{ data: "id", title: "ID" },
{ data: 'employeeName', title: 'Name' }
]
}
});
Tickets.attachSchema(new SimpleSchema({
id: { type: Number, label:'Id del Empleado', optional: true },
employeeName: { type: String, label:'Name', optional: true }
}));
if (Meteor.isServer) {
Meteor.publish('get_Tickets', function() {return Tickets.find();});
};
if (Meteor.isClient) {
Meteor.subscribe('get_Tickets');
};
My.html
{{> tabular table=collection.tabularTable class="table table-striped bordered" id=collection.pluralName }}
SECOND OPTION WITH INSTANCE OF DATATABLE
my.js
var TicketsTab=new Tabular.Table({
name: 'Tickets',
collection: Tickets,
searching:true,
columns: [
{data: "id",title:"ID"},
{data: "employeeName",title:"Name"}
]
});
var myTable = $('#TicketsTab').DataTable();
yadcf.init(myTable, [{column_number:0}]);
In this point I can´t conclude because I don´t know how to add .dataTable().yadcf([...]);

ag-Grid, try to make Tree Demo work using own data

I like the ag-Grid because it's less buggy, fast and works with many frameworks.
So I tried the Tree Data, no need to tell the link between parents and children, simply lay down the data in structure, specify some options, Bingo! But, when I plug in my API, it tells me
"TypeError: rowData is undefined"
from inside of ag-grid.js even though Watch clearly shows it has the array. There are some answered Question here regarding customization with internal api. Mine is not.
I then use the official demo as a base, set up a Fiddler to grab the raw data in JSON replace demo data to make it hardcoded for a test to determine if it's problem with own API or something else. Here is the Plunker. Note it's totally based on the official javaScript Demo of Tree Data, Tree Data Example, the first one.
In case you don't want to see Plunker, here is my .js:
var columnDefs = [
{headerName: "Client", field: "Client", cellRenderer: 'group'},
{headerName: "Program", field: "Program"}
/*{headerName: "Group", field: "xgroup", cellRenderer: 'group'}, // cellRenderer: 'group'}, -- this "group" is one of the default value option for built-in cellRenderer function, not field.
//{headerName: "Athlete", field: "athlete"},
//{headerName: "Year", field: "year"},
{headerName: "Country", field: "country"}
*/
];
var myData = [
{
'Client': 'Goodle',
'Program': 'no grid',
'kids': []
},
{
'Client': 'Facebrook',
'Program': 'grids',
'kids': [
{
'Client': 'Facebrook',
'Program': 'ag-Grid'
},
{
'Client': 'Facebrook',
'Program': 'ui-grid'
}
]
}
/*{xgroup: 'Group A',
participants: [
/*{athlete: 'Michael Phelps', year: '2008', country: 'United States'},
{athlete: 'Michael Phelps', year: '2008', country: 'United States'},
{athlete: 'Michael Phelps', year: '2008', country: 'United States'}*/
/*]},
{xgroup: 'Group B', athlete: 'Sausage', year: 'Spaceman', country: 'Winklepicker',
participants: [
{athlete: 'Natalie Coughlin', year: '2008', country: 'United States'},
{athlete: 'Missy Franklin ', year: '2012', country: 'United States'},
{athlete: 'Ole Einar Qjorndalen', year: '2002', country: 'Norway'},
{athlete: 'Marit Bjorgen', year: '2010', country: 'Norway'},
{athlete: 'Ian Thorpe', year: '2000', country: 'Australia'}
]},
{xgroup: 'Group C',
participants: [
{athlete: 'Janica Kostelic', year: '2002', country: 'Crotia'},
{athlete: 'An Hyeon-Su', year: '2006', country: 'South Korea'}
]}*/
];
var gridOptions = {
columnDefs: columnDefs,
rowData: myData,
rowSelection: "single",
enableSorting: "true", unSortIcon: "true",
enableColResize: "true",
enableRangeSelection: "true",
suppressCellSelection: "false",
showToolPanel: "true",
supressCopyRowsToClipboard: true,
supressCellSelection: false,
getNodeChildDetails: getNodeChildDetails,
onGridReady: function(params) {
params.api.sizeColumnsToFit();
}
};
function getNodeChildDetails(rowItem) {
if (rowItem.Client) {
return {
group: true,
// open C be default
//expanded: rowItem.ClientName === 'Group C',
// provide ag-Grid with the children of this group
children: rowItem.kids,
// this is not used, however it is available to the cellRenderers,
// if you provide a custom cellRenderer, you might use it. it's more
// relavent if you are doing multi levels of groupings, not just one
// as in this example.
//field: 'group',
// the key is used by the default group cellRenderer
key: rowItem.Client
};
} else {
return null;
}
}
function onFilterChanged(value) {
gridOptions.api.setQuickFilter(value);
}
// setup the grid after the page has finished loading
document.addEventListener('DOMContentLoaded', function() {
var gridDiv = document.querySelector('#myGrid');
new agGrid.Grid(gridDiv, gridOptions);
});
HTML:
<html>
<head>
<!-- you don't need ignore=notused in your code, this is just here to trick the cache -->
<script src="https://ag-grid.com/dist/ag-grid/ag-grid.js"></script>
<script src="script.js"></script>
</head>
<body>
<input placeholder="Filter..." type="text"
onpaste="onFilterChanged(this.value)"
oninput="onFilterChanged(this.value)"
onchange="onFilterChanged(this.value)"
onkeydown="onFilterChanged(this.value)"
onkeyup="onFilterChanged(this.value)"/>
<div id="myGrid" class="ag-fresh" style="height: 450px; margin-top: 4px;"></div>
</body>
</html>
Need some experts!
You need to alter getNodeChildDetails to have this:
function getNodeChildDetails(rowItem) {
if (rowItem.Client && rowItem.kids && rowItem.kids.length > 0) {
As you have it you're telling the grid that any item with Client is a parent node, but what you really mean in your data is any item with Client AND kids is a parent.
Remember that the grid can have multiple levels so a child can be a parent too.

jsTree contextmenu does not work along with jsTreeGrid

I am new to jsTree. As I am in need to represent the node types also along with node names, I have moved to jsTreeGrid. I am in a need to create nodes, rename, delete, edit the tree nodes as well as edit the node types in the second column of the jsTreeGrid. Somehow I could edit the second column (ie.,type column) but the jsTree just displays the contextmenu but their corresponding functions are not called. Help on this would be very useful. Here is my code:
<div id="container"></div>
<script type="text/javascript">
$(document).ready(function(){
var data;
data = [{
text: "Satellite City",
data: {type: "<b>Project</b>", size: "30",spanclass:"root"},
children: [
{text: "Phase-1", data: {type: "<i>Phase</i>", size: "50",spanclass:"first"}},
{text: "Phase-2", data: {type: "<i>Phase</i>", size: "50",spanclass:"second"}, children:[
{text:"Ruby Towers",data:{type: "<i>Tower</i>",size:"50",spanclass:"third"}}
]}
]
}];
$("div#container").jstree({
plugins: ["themes", "json", "grid", "dnd", "contextmenu", "search"],
core: {
data: data
},
grid: {
columns: [
{width: 300, header: "WBS Tree",title:"_DATA_"},
{width: 100,
cellClass: "col1",
value: "type",
header: "<i>Node Type</i>",
valueClass:"spanclass"
},
],
resizable:true,
contextmenu:true
},
dnd: {
drop_finish : function () {
},
drag_finish : function () {
},
drag_check : function (data) {
return {
after : true,
before : true,
inside : true
};
}
}
});
$("input#search").keyup(function (e) {
var tree = $("div#container").jstree();
tree.search($(this).val());
});
});
</script>
I think your problem might be in the jsTree config. Try adding "check_callback": true to its core.
Or check out working fiddle - JS Fiddle.