Hello guys, I have implemented a JSGrid control and have it working great so far. However, I need to implement some validations in some of the cells. I followed the process as outlined in this article: http://msdn.microsoft.com/en-us/library/office/hh673521(v=office.14).aspx, very helpful by the way. But I noticed that I cannot use the type I'm registering.
I have a field called "Description", which is String and created a new propType called "myString." this is the way I registered the new propType.
var basePropType = SP.JsGrid.Internal.Property.GetPropType('String');
var myStringPropType = SP.Internal.JS.object(basePropType);
myStringPropType.ID = 'myString';
SP.JsGrid.PropertyType.RegisterNewDerivedCustomPropType(myStringPropType, 'String');
And I specified the proptype in the formatGridFields method for the Description column as follows.
publicstaticGridField formatGridField(GridField gf,DataColumn dc)
{
// Set field key name.
gf.FieldKey = dc.ColumnName;
// When in doubt, serialize the data value.
gf.SerializeDataValue = true;
if (dc.ColumnName != "Key"
&& dc.ColumnName != GridSerializer.DefaultGridRowStyleIdColumnName
// Uncomment for the Create a Gantt Chart Using JS Grid how-to.
&& dc.ColumnName != GridSerializer.DefaultGanttBarStyleIdsColumnName
&& dc.ColumnName != "HierarchyParentKey")
{
// Add properties based on the type.
if (dc.DataType == typeof(String))
{
if (dc.ColumnName == "Description")
{
gf.PropertyTypeId = "myString";
}
Now, here is the issue that I'm having. If I set the PropertyTypeId to "String" works fine. But if I specify "myString" the JSGrid errors out.
When debugging the WebPart the JSGrid.debug.js file opens and I was able to see what happened. The property type is not defined for the Description field.
And something important to note is, that "myString" is actually registered as it appears listed in the defaultControlsMap object.
Any ideas as to what I'm missing here?
I have spent several days trying to figure this one out and until now I was able to see that the type is actually registered but looks like is not being assigned to the "Description" field.
Thank you so much in advance.
Jose M. Cadenas, Msc. Sr. Developer