jsgrid icon indicating copy to clipboard operation
jsgrid copied to clipboard

Validator callback function get only one value in item array

Open freetibet000 opened this issue 5 years ago • 1 comments


fields: [
		{ name: "id", title: "Id", type: "text", width: 30, editing: false },
		{ name: "collection", title: "Коллекция", type: "text", width: 200,
			validate: { 
				message: "Название коллекции не может быть пустым или уже существует", validator: 
					function(value, item) { 
						console.log(value, item);							
					} 
				} 
			},
 		{ name: "link", title: "Ссылка", type: "text", width: 200, editing: false },
		{ type: "control" }
]

Output of console.log value: test333 item: {collection: "test333"}

So i can get value, but item array contains only validated field as well. But as i understand it should contain array with all fields of row.

freetibet000 avatar Feb 12 '21 13:02 freetibet000


fields: [
		{ name: "id", title: "Id", type: "text", width: 30, editing: false },
		{ name: "collection", title: "Коллекция", type: "text", width: 200,
			validate: { 
				message: "Название коллекции не может быть пустым или уже существует", validator: 
					function(value, item) { 
						console.log(value, item);							
					} 
				} 
			},
 		{ name: "link", title: "Ссылка", type: "text", width: 200, editing: false },
		{ type: "control" }
]

Output of console.log value: test333 item: {collection: "test333"}

So i can get value, but item array contains only validated field as well. But as i understand it should contain array with all fields of row.

It works as per the documented. It returns the item of the row. I am unable to reproduce your problem. will you share your code? so only i can help you and which version of jsGrid do you have using

nandakumar-a avatar Feb 17 '21 04:02 nandakumar-a