I encounter the following warning from redux toolkit.
However the error is not specificying where the non-seralizable actually is in my state.
My raw state from the redux dev tools looks like this. The warning occurs immededtly after starting the application.
user: {
ids: [
'61345318-2f7c-41ff-996c-4e537afcd5a1'
],
entities: {
'61345318-2f7c-41ff-996c-4e537afcd5a1': {
sub: '61345318-2f7c-41ff-996c-4e537afcd5a1',
email_verified: true,
name: 'Daniel Hallosdfsdf',
preferred_username: 'dani_1234',
email: 'sdfdsfdsfsdf#foo.com'
}
},
loggedInUser: '61345318-2f7c-41ff-996c-4e537afcd5a1',
isAuthenticated: true,
authenticationIsLoading: false,
loginIsLoading: false,
registerIsLoading: false,
deleteAccountAWSIsLoading: false,
resendSignUpLingIsLoading: false,
fullNameChangingIsLoading: false,
updateUsernameIsLoading: false,
sendCodeForMailUpdateIsLoading: false,
verifyEmailChangeCodeIsLoading: false,
passwordChangingIsLoading: false,
passwordForgottenMailIsSendLoading: false,
passwordChangingAfterPasswordForgottenIsLoading: false,
checkIfMailExistsIsLoading: false,
checkIfUsernameExistsIsLoading: false,
userSessionIsLoading: 'success',
userIsLoading: 'sucess',
getUpdatedSUYUHUserIsLoading: false,
getUpdatedAWSUserIsLoading: false
},
story: {
ids: [],
entities: {},
storyList: {
isLoading: 'idle',
count: '',
numberOfStories: '',
ids: []
},
storyListSideBarMap: {
isLoading: 'idle',
count: '',
numberOfStories: '',
ids: []
},
singleStory: {
isLoading: 'idle',
id: ''
},
updateStoryIsLoading: false,
postStoryIsLoading: false
},
place: {
ids: [],
entities: {},
placeList: {
count: '',
ids: []
},
placeSlider: {
isLoading: 'idle',
ids: []
},
placesOfStory: {
isLoading: 'idle'
},
placeBar: {
isLoading: 'idle',
id: ''
},
placesOnMap: {
isLoading: 'idle',
ids: []
},
selectedPlaceId: ''
},
profile: {
ids: [
'dani_1234'
],
entities: {
dani_1234: {
cognitoId: '61345318-2f7c-41ff-996c-4e537afcd5a1',
username: 'dani_1234',
bio: 'xcyvycxvxcvcxvcxv',
shortTitle: 'MUCsdfsdfdsfdsfng',
image: 'http://localhost:8000/media/profile_pics/Capture_1_5F75wR1.JPG',
storiesUrl: 'http://localhost:8000/api/v1/stories/?author=61345318-2f7c-41ff-996c-4e537afcd5a1',
placesUrl: 'http://localhost:8000/api/v1/places/?author=61345318-2f7c-41ff-996c-4e537afcd5a1',
storiesCount: 1,
placesCount: 1,
profileOwnerPermission: true
}
},
profileList: {
isLoading: 'idle',
count: '',
ids: []
},
profileListSideBar: {
isLoading: 'idle',
count: '',
ids: []
},
profileBar: {
isLoading: true,
id: ''
},
header: {
isLoading: 'failure',
id: 'dani_1234'
},
profilesOfStory: {
isLoading: 'idle'
},
updateProfileImageIsLoading: false,
updateDescriptionIsLoading: false,
deleteProfileImageIsLoading: false,
updateNicknameIsLoading: false
},
storyImage: {
ids: [],
entities: {},
storyImageList: {
isLoading: 'idle',
ids: []
},
addStoryImageIsLoading: false,
updateStoryImageIsLoading: false,
deleteStoryImageIsLoading: false
},
userInterface: {
ids: [],
entities: {},
profileEditIsOpen: false,
stepProfileEdit: 'EditProfile',
userAuthenticatesIsOpen: false,
stepUserAuthenticates: 'signIn',
browseMapOverlayIsOpen: false
}
}
I am happy for any clarification that helps me to find the non serializable value.
Related
I'm software engineer in Cambodia.
I want to custom Grid.js pagination with supanase, but I faced a problem.
I don't know the solution because it's not in the documentation.
I'm using Nuxt 3
Please tell me how to implement.
The Code is below:
onMounted(() => {
grid.updateConfig({
columns: [
{ name: 'Avatar', id: 'avatar' },
{ name: 'name', id: 'name' },
{ name: 'gender', id: 'gender' },
{ name: 'email', id: 'email' },
{ name: 'phone', id: 'phone' },
{ name: 'address', id: 'address' },
],
pagination: {
enabled: true,
limit: 5,
server: {
url: (prev, page, limit) => `${prev}&limit=${limit}&offset=${page * limit}`
},
summary: true,
},
server: {
keepalive: true,
data: async (opt) => {
console.log(opt)
const { data: customers, error, count } = await supabase
.from('customers')
.select('id, name, gender, email, phone, address, avatar', { count: 'exact' })
.is('deleted_at', null)
.order('created_at', { ascending: false })
return {
data: customers.map((customer) => [
customer.avatar,
customer.name,
customer.gender,
customer.email,
customer.phone,
customer.address,
]),
total: count,
}
},
},
width: '100%',
search: true,
pagination: true,
fixedHeader: true,
className: {
td: 'sr-td-class',
table: 'sr-table',
},
})
grid.render(table.value)
})
I found resolve:
GridJs configuration:
onMounted(() => {
grid.updateConfig({
columns: [
{ name: 'Avatar', id: 'avatar' },
{ name: 'name', id: 'name' },
{ name: 'gender', id: 'gender' },
{ name: 'email', id: 'email' },
{ name: 'phone', id: 'phone' },
{ name: 'address', id: 'address' },
],
pagination: {
enabled: true,
limit: 5,
server: {
url: (prev, page, limit) => `${prev}&limit=${limit}&offset=${page * limit}`
},
summary: true,
},
server: {
keepalive: true,
data: async (opt) => {
console.log(opt)
const { data: customers, error, count } = await supabase
.from('customers')
.select('id, name, gender, email, phone, address, avatar', { count: 'exact' })
.is('deleted_at', null)
.order('created_at', { ascending: false })
return {
data: customers.map((customer) => [
customer.avatar,
customer.name,
customer.gender,
customer.email,
customer.phone,
customer.address,
]),
total: count,
}
},
},
width: '100%',
fixedHeader: true,
className: {
td: 'sr-td-class',
table: 'sr-table',
},
})
grid.render(table.value)
})
Then create server/api directory
after create file customers.ts in server/api/ directory
This is code in customers.ts file
import { serverSupabaseUser, serverSupabaseClient } from '#supabase/server'
export default defineEventHandler(async (event) => {
const user = await serverSupabaseUser(event)
const client = serverSupabaseClient(event)
const query = useQuery(event)
const from = query.page ? parseInt(query.page) * parseInt(query.limit) : 0
const to = query.page ? from + parseInt(query.limit) : query.limit
if (!user) {
throw createError({ statusCode: 401, message: 'Unauthorized' })
}
const { data, error, count } = await client
.from('customers')
.select('id, name, gender, email, phone, address, avatar', {
count: 'exact',
})
.is('deleted_at', null)
.order('created_at', { ascending: false })
.range(from, to)
return { customers: data, count }
})
In a Nextjs project using next-i18next, I'm trying to read language json file from a cms but my configuration is not working.
This is my 'next-i18next.config.js':
const I18NextHttpBackend = require('i18next-http-backend/cjs');
module.exports = {
debug: process.env.NODE_ENV === 'development',
reloadOnPrerender: process.env.NODE_ENV === 'development',
i18n: {
defaultLocale: 'es',
locales: ['es'],
localeDetection: false,
},
ns: ['translation'],
defaultNS: 'translation',
react: {
useSuspense: true,
},
backend: {
loadPath: 'http://localhost:3001/locales/{{lng}}/{{ns}}.json',
requestOptions: {
cache: 'default',
credentials: 'same-origin',
mode: 'no-cors',
},
},
serializeConfig: false,
use: isBrowser ? [I18NextHttpBackend] : [],
}
I'm following the examples that I found in the official repository of the next-i18next and in the i18next-http-backend next example.
The endpoint has an object like:
{"title": "My title"}
This is the debug:
{
"debug": true,
"initImmediate": true,
"ns": [
"translation"
],
"defaultNS": "translation",
"fallbackLng": [
"es"
],
"fallbackNS": false,
"supportedLngs": false,
"nonExplicitSupportedLngs": false,
"load": "currentOnly",
"preload": false,
"simplifyPluralSuffix": true,
"keySeparator": ".",
"nsSeparator": ":",
"pluralSeparator": "_",
"contextSeparator": "_",
"partialBundledLanguages": false,
"saveMissing": false,
"updateMissing": false,
"saveMissingTo": "fallback",
"saveMissingPlurals": true,
"missingKeyHandler": false,
"missingInterpolationHandler": false,
"postProcess": false,
"postProcessPassResolved": false,
"returnNull": true,
"returnEmptyString": true,
"returnObjects": false,
"joinArrays": false,
"returnedObjectHandler": false,
"parseMissingKeyHandler": false,
"appendNamespaceToMissingKey": false,
"appendNamespaceToCIMode": false,
"interpolation": {
"escapeValue": false,
"prefix": "{{",
"suffix": "}}",
"formatSeparator": ",",
"unescapePrefix": "-",
"nestingPrefix": "$t(",
"nestingSuffix": ")",
"nestingOptionsSeparator": ",",
"maxReplaces": 1000,
"skipOnVariables": true
},
"errorStackTraceLimit": 0,
"localeExtension": "json",
"localePath": "./public/locales",
"localeStructure": "{{lng}}/{{ns}}",
"react": {
"useSuspense": true
},
"reloadOnPrerender": true,
"serializeConfig": false,
"use": [
null
],
"backend": {
"loadPath": "http://localhost:3001/locales/{{lng}}/{{ns}}.json",
"requestOptions": {
"cache": "default",
"credentials": "same-origin",
"mode": "no-cors"
},
"addPath": "/locales/add/{{lng}}/{{ns}}",
"allowMultiLoading": false,
"reloadInterval": false,
"customHeaders": {},
"queryStringParams": {},
"crossDomain": false,
"withCredentials": false,
"overrideMimeType": false
},
"lng": "es",
"defaultLocale": "es",
"locales": [
"es"
],
"localeDetection": false,
"resources": {
"es": {
"translation": {}
},
"en": {
"translation": {}
},
"ca": {
"translation": {}
}
},
"ignoreJSONStructure": true
}
Thanks.
If you want to use always your custom loadPath (client and server side), you need to do this:
module.exports = {
debug: process.env.NODE_ENV === 'development',
reloadOnPrerender: process.env.NODE_ENV === 'development',
i18n: {
defaultLocale: 'es',
locales: ['es', 'en'],
localeDetection: false,
},
ns: ['translation'],
defaultNS: 'translation',
react: {
useSuspense: true,
},
backend: {
loadPath: 'http://localhost:3000/api/{{ns}}/{{lng}}',
requestOptions: {
cache: 'default',
credentials: 'same-origin',
mode: 'no-cors',
}
},
serializeConfig: false,
use: [I18NextHttpBackend],
}
You need to also conditionally set the backend options:
module.exports = {
debug: process.env.NODE_ENV === 'development',
reloadOnPrerender: process.env.NODE_ENV === 'development',
i18n: {
defaultLocale: 'es',
locales: ['es', 'en'],
localeDetection: false,
},
ns: ['translation'],
defaultNS: 'translation',
backend: isBrowser ? {
loadPath: 'http://localhost:3000/locales/{{lng}}/{{ns}}.json',
requestOptions: {
cache: 'default',
credentials: 'same-origin',
mode: 'no-cors',
},
} : undefined,
serializeConfig: false,
use: isBrowser ? [I18NextHttpBackend] : [],
}
I need to set slugs of my subcategories ,and i am using autovalue for this. I need to know the index of actual field for when i use arrays. There is a wild card for this?
Eg:
subcategories.$.subs.$.name
subcategories: {
type: [Object],
optional: true,
},
"subcategories.$.name": {
type: String,
optional: true,
},
"subcategories.$.slug": {
type: String,
optional: true,
autoform: {
omit: true
},
autoValue: function() {
if (this.field('subcategories.$.name').isSet) {
return s.slugify( (this.field('subcategories.$.name').value).toLowerCase() );
}
},
},
"subcategories.$.subs": {
type: [Object],
optional: true,
},
"subcategories.$.subs.$.name": {
type: String,
optional: true,
},
"subcategories.$.subs.$.slug": {
type: String,
optional: true,
autoform: {
omit: true
},
autoValue: function(i) {
if (this.field('subcategories.$.subs.$.name').isSet) {
return s.slugify( (this.field('subcategories.$.subs.$.name').value).toLowerCase() );
}
},
},
Thanks,
I got the expected result by changing the schema. Besides getting more organized, this.siblingField('name') works!
Code:
Categories = new Mongo.Collection('categories');
Schemas = {};
Schemas.Subs = new SimpleSchema({
"name": {
type: String,
optional: true,
},
"slug": {
type: String,
optional: true,
autoform: {
omit: true,
},
autoValue: function() {
if (this.siblingField('name').isSet) {
return s.slugify( (this.siblingField('name').value).toLowerCase() );
}
},
},
});
Schemas.Subcategories = new SimpleSchema({
"name": {
type: String,
optional: true,
},
"slug": {
type: String,
optional: true,
autoform: {
omit: true,
},
autoValue: function() {
if (this.siblingField('name').isSet) {
return s.slugify( (this.siblingField('name').value).toLowerCase() );
}
},
},
"subs": {
type: [Schemas.Subs],
optional: true,
},
});
Schemas.Categories = new SimpleSchema({
name: {
type: String,
},
slug:{
type: String,
unique: true,
index: 1,
autoform: {
omit: true
},
autoValue: function() {
if (this.field('name').isSet) {
return s.slugify( (this.field('name').value).toLowerCase() );
}
},
},
subcategories: {
type: [Schemas.Subcategories],
optional: true,
},
});
Categories.attachSchema(Schemas.Categories);
Could you please help me how I could do to delete multiple records selected in my jqgrid? I've tried a number of ways, but so far not got any success. I will be grateful to anyone who can help me.
jQuery("#grid-table").jqGrid({
//direction: "rtl",
url: "/Lojas/GetLojas",
datatype: 'json',
mtype: 'Get',
height: '100%',
colNames: [ ' ',
'Name',
'Description'
],
colModel: [
{
name: 'myac', index: '', width: 65, fixed: true, sortable: false, resize: false,
formatter: 'actions',
formatoptions: {
keys: true,
delOptions: { recreateForm: true, url: '/Lojas/Delete', beforeShowForm: beforeDeleteCallback },
editformbutton: true, editOptions: { recreateForm: true, url: '/Lojas/Edit', closeAfterEdit: true, beforeShowForm: beforeEditCallback, closeOnEscape: true }
}
},
{ key: true, hidden: true, name: 'Id', index: 'Id', sorttype: "int", editable: false },
{ key: false, name: 'Name', index: 'Name', editable: true},
{ key: false, name: 'Description', index: 'Description', editable: true}
],
viewrecords: true,
loadonce: true,
rowNum: 10,
rowList: [5, 10, 15],
jsonReader: {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
Id: "0"
},
pager: pager_selector,
altRows: true,
autowidth: true,
multiselect: true,
multiboxonly: true,
sortorder: "desc",
multiboxonly: true,
caption: "Lojas Cadastradas"
});
//navButtons
jQuery("#grid-table").jqGrid('navGrid', pager_selector,
{
edit: true,
add: true,
del: true,
search: true,
refresh: true,
view: true,
},
{
url: '/Lojas/Edit',
closeOnEscape: true,
closeAfterEdit: true,
recreateForm: true
},
{
url: '/Lojas/Create',
closeOnEscape: true,
closeAfterAdd: true,
recreateForm: true
},
{
url: '/Lojas/Delete',
closeOnEscape: true,
closeAfterDelete: true,
recreateForm: true
},
{
//search form
recreateForm: true,
closeOnEscape: true,
closeAfterSearch: true,
multipleSearch: true
},
{
//view record form
recreateForm: true
}
)
Code in my controller:
public ActionResult Delete(Loja loja)
{
Loja lojaToDelete = db.Lojas.Find(loja.Id);
if (lojaToDelete == null)
{
return HttpNotFound();
}
db.Lojas.Remove(lojaToDelete);
db.SaveChanges();
return View(loja);
}
I recommend you to change prototype of Delete function public ActionResult Delete(Loja loja) to
public void Delete(string id)
The main problem in your code is the following. Corresponds to the documentation jqGrid post id parameter to url: '/Lojas/Delete'. You can rename the name of id parameter using prmNames. In the case you can use prmNames: {id: "Id"}, but it's not really required.
If multiple rows needed be deleted then id string will be comma separated and you can use something like
public void Delete(string id)
{
var ids = id.Split(',');
foreach (lojaId in ids) {
Loja lojaToDelete = db.Lojas.Find(lojaId);
if (lojaToDelete == null)
throw new HttpResponseException(HttpStatusCode.NotFound);
db.Lojas.Remove(lojaToDelete);
}
db.SaveChanges();
}
I am newbie in stackoverflow and newbie with Kendo UI and newbie with web development ... I was born yesterday :). Joking apart my question is not really a question, I know the forum rules over specific questions but I need help.
My problem is this:
I adapted the Kendo UI MVC Music Store tutorial but with use MVC ASP.net (I work with Delphi) and it not works.
I have two files:
Category.html
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Administración de Categorías</title>
<link href="kendo/styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="kendo/styles/kendo.default.min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css/menuvir.css" type="text/css"/>
<script src="kendo/js/jquery.min.js" type="text/javascript"></script>
<script src="kendo/js/kendo.web.min.js" type="text/javascript"></script>
</head>
<body>
<div id="categGrid"></div>
<script src="js/category.js type="text/javascript"></script>
</body>
</html>
and Category.js
(function (window, $, kendo) {
var getCategAsync = function () {
var deferred = $.Deferred(),
translateCateg = function (data) {
deferred.resolve($.map(data.result, function(item) {
return {
value: item.ID,
text: item.Description
};
}));
},
loadCateg = function () {
new kendo.data.DataSource({
type: "json",
transport: {
read: "/w/Category?select=ID,Description"
},
schema: {
data: 'result'/*,
total: store.config.wcfSchemaTotal*/
}
}).fetch(function (data) {
translateCateg(data);
});
};
window.setTimeout(loadCateg, 1);
return deferred.promise();
};
var getLangAsync = function () {
var deferred = $.Deferred(),
translateLang = function (data) {
deferred.resolve($.map(data.result, function(item) {
return {
value: item.ID,
text: item.Description
};
}));
},
loadLang = function () {
new kendo.data.DataSource({
type: "json",
transport: {
read: "/w/Language?select=ID,Description"
},
schema: {
data: 'result'/*,
total: store.config.wcfSchemaTotal*/
}
}).fetch(function (data) {
translateLang(data);
});
};
window.setTimeout(loadLang, 1);
return deferred.promise();
};
var initGrid = function (categs, langs, categEditor, langEditor) {
$("#categGrid").kendoGrid({
sortable: true,
groupable: false, //true,
filterable: false, //true,
pageable: true,
editable: "inline",
toolbar: ["create"],
dataSource: {
type: "json",
pageSize: 10,
serverPaging: false, //true,
serverFiltering: false, //true,
serverSorting: false, //true,
sort: { field: "SortOrder", dir: "asc" },
transport: {
type: "json",
read: {
url: "/w/Category?select=ID,Description",
type: "GET"
}/*,
update: {
url: function (data) {
return store.config.albumsUrl + "(" + data.AlbumId + ")"
},
type: "PUT"
},
destroy: {
url: function (data) {
return store.config.albumsUrl + "(" + data.AlbumId + ")";
},
type: "DELETE"
},
create: {
url: store.config.albumsUrl,
type: "POST"
} */
},
schema: {
data: "result",
//total: store.config.wcfSchemaTotal,
model: {
id: "ID",
fields: {
ID: { type: "number" },
Description: { type: "string", validation: {required: true} },
Language: { type: "number", defaultValue: 1 },
SortOrder: { type: "number", defaultValue: 0 },
Status: { type: "number", defaultValue: 0 },
Parent: { type: "number", defaultValue: 0 }
}
}
},
},
columns: [
{ field: "ID", title: "ID", editable: false, filterable: false, width: 20 },
{ field: "Description", title: "Descripción", filterable: false, width: 150 },
{ field: "Language", title: "Idioma", values: langs, editor: langEditor, filterable: false, width: 50 },
{ field: "SortOrder", title: "Orden", filterable: false, width: 20 },
{ field: "Status", title: "Estado", filterable: false, width: 50 },
{ field: "Parent", title: "Subcategoría de", values: categs, editor: categEditor, filterable: false, width: 150 },
{ command: ["edit", "destroy"], title: " ", width: "160px" }
]
});
};
// Wait for both the genres and artists lists to load.
$.when(getCategAsync(), getLangAsync())
.done(function(categs, langs) {
var categEditor = function (container, options) {
$('<input data-text-field="text" data-value-field="value" data-bind="value:' + options.field + '" />')
.appendTo(container)
.kendoComboBox({
autoBind: false,
dataSource: categs
});
};
var langEditor = function (container, options) {
$('<input data-text-field="text" data-value-field="value" data-bind="value:' + options.field + '" />')
.appendTo(container)
.kendoComboBox({
autoBind: false,
dataSource: langs
});
};
initGrid(categs, langs, categEditor, langEditor);
});
})(window, jQuery, kendo);
When I execute this nothing is showing and no error in Firebug console.
What's wrong ? Any help is appreciatted.
Thanks in advance and sorry for my english.
UPDATE
Sorry, I forgot update the Category.html code here, but I always had the value right "id" and yet it not works. Thanks for the quick response.
Well, for starters your JQuery is attempting to create a KendoGrid on an ID that isn't present in your HTML
$("#categGrid").kendoGrid(
doesn't match anything in your HTML. Did you mean
$("#grid").kendoGrid({
which would find
<div id="grid"></div>
I solved the problem. I changed some options I adapted erroneously.
This is the code that works.
(function (window, $, kendo) {
var getCategAsync = function () {
var deferred = $.Deferred(),
translateCateg = function (data) {
deferred.resolve($.map(data.items, function(item) {
return {
value: item.ID,
text: item.Description
};
}));
},
loadCateg = function () {
new kendo.data.DataSource({
transport: {
read: {
url: "/w/Category?select=ID,Description",
dataType: "json",
type: "GET"
}
},
schema: {
data: 'result'/*,
total: store.config.wcfSchemaTotal*/
}
}).fetch(function (data) {
translateCateg(data);
});
};
window.setTimeout(loadCateg, 1);
return deferred.promise();
};
var getLangAsync = function () {
var deferred = $.Deferred(),
translateLang = function (data) {
deferred.resolve($.map(data.items, function(item) {
return {
value: item.ID,
text: item.Description
};
}));
},
loadLang = function () {
new kendo.data.DataSource({
transport: {
read: {
url: "/w/Language?select=ID,Description",
dataType: "json",
type: "GET"
}
},
schema: {
data: 'result'/*,
total: store.config.wcfSchemaTotal*/
}
}).fetch(function (data) {
translateLang(data);
});
};
window.setTimeout(loadLang, 1);
return deferred.promise();
};
var initGrid = function (categs, langs, categEditor, langEditor) {
$("#categGrid").kendoGrid({
sortable: true,
groupable: false, //true,
filterable: false, //true,
pageable: true,
editable: "inline",
toolbar: ["create"],
dataSource: {
type: "json",
pageSize: 10,
serverPaging: false, //true,
serverFiltering: false, //true,
serverSorting: false, //true,
sort: { field: "SortOrder", dir: "asc" },
transport: {
read: {
url: "/w/Category?select=*",
type: "GET",
dataType: "json"
}/*,
update: {
url: function(data) {
return "/w/Category?ID=" + data.ID;
},
contentType: "application/json",
type: "PUT"
},
destroy: {
url: function (data) {
return store.config.albumsUrl + "(" + data.AlbumId + ")";
},
type: "DELETE"
},
create: {
url: store.config.albumsUrl,
type: "POST"
} */
},
schema: {
data: "result",
total: function(response) {
return response.result.length;
},
model: {
id: "ID",
fields: {
ID: { type: "number" },
Description: { type: "string", validation: {required: true} },
Language: { type: "number", defaultValue: 1 },
SortOrder: { type: "number", defaultValue: 0 },
Status: { type: "number", defaultValue: 0 },
Parent: { type: "number", defaultValue: 0 }
}
}
},
},
columns: [
{ field: "ID", title: "ID", editable: false, filterable: false, width: 20 },
{ field: "Description", title: "Descripción", filterable: false, width: 150 },
{ field: "Language", title: "Idioma", values: langs, editor: langEditor, filterable: false, width: 50 },
{ field: "SortOrder", title: "Orden", filterable: false, width: 20 },
{ field: "Status", title: "Estado", filterable: false, width: 50 },
{ field: "Parent", title: "Subcategoría de", values: categs, editor: categEditor, filterable: false, width: 150 },
{ command: ["edit", "destroy"], title: " ", width: "160px" }
]
});
};
// Wait for both the genres and artists lists to load.
$.when(getCategAsync(), getLangAsync())
.done(function(categs, langs) {
var categEditor = function (container, options) {
$('<input data-text-field="text" data-value-field="value" data-bind="value:' + options.field + '" />')
.appendTo(container)
.kendoComboBox({
autoBind: false,
dataSource: categs
});
};
var langEditor = function (container, options) {
$('<input data-text-field="text" data-value-field="value" data-bind="value:' + options.field + '" />')
.appendTo(container)
.kendoComboBox({
autoBind: false,
dataSource: langs
});
};
initGrid(categs, langs, categEditor, langEditor);
});
})(window, jQuery, kendo);
Thanks.