jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Validation error not aligned properly with the grid cell
Tagged: javascript grid validation
This topic contains 1 reply, has 2 voices, and was last updated by Peter Stoev 10 years, 11 months ago.
-
Author
-
Hi
Sample grid code tried in JS Fiddle:
var data = generatedata(500); var source = { localdata: data, datafields: [{ name: 'firstname', type: 'string' }, { name: 'lastname', type: 'string' }, { name: 'productname', type: 'string' }, { name: 'date', type: 'date' }, { name: 'quantity', type: 'number' }, { name: 'price', type: 'number' }], datatype: "array" }; var adapter = new $.jqx.dataAdapter(source); $("#jqxgrid").jqxGrid({ width: 500, theme: 'energyblue', editable: true, editmode: 'selectedrow', selectionmode: 'singlerow', source: adapter, sortable: true, columns: [{ text: 'First Name', datafield: 'firstname', width: 90, validation : function(cell, value){ if (value.length > 5) { return { result: false, message: "Firstname cannot be greater than 5" }; } return true;} }, { text: 'Last Name', datafield: 'lastname', width: 90 }, { text: 'Product', datafield: 'productname', width: 170 }, { text: 'Order Date', datafield: 'date', width: 160, cellsformat: 'dd-MMMM-yyyy' }, { text: 'Quantity', datafield: 'quantity', width: 80, cellsalign: 'right' }, { text: 'Unit Price', datafield: 'price', cellsalign: 'right', cellsformat: 'c2' }] });
I enter more than 5 characters in the ‘First Name’ column and focus out of the row. The validation error that was shown is not under the ‘First Name’ column and it is at the last of the row.
Thanks
ShankarHi Shankar,
You’re right. The message is not displayed exactly below the required field. The reason is that the whole row’s validation has failed in Full Row Edit mode, but I agree that the positioning should be enhanced.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.