I'm attempting to "select" an item within the custom table datagrid web part and dynamically populate the Detail page path using a macro. It fails to work properly when I have a custom table object I've created based on a table that was manually created via query or SSMS.
My steps were:
- I created a new table in SSMS called MyNotifications.
- I added 3 fields: NotificationID (primary key, auto generated INT), NotificationText (nvarchar(max)), PublishTo, PublishFrom (both dates).
- I create the table within the Site Manager>Development>Custom Tables and enter my custom table display name as well as selecting the existing, MyNotifications table.
- I selected all the checkboxes to include the other default fields (ItemGUID, ItemCreatedBy, etc.).
- All works well when creating the table and displaying the data in other web parts.
Now I add the Custom table datagrid web part to a page. I selected the MyNotifications custom table and enter the Order by property. I selected the Displayed columns, which included NotificationID, NotificationText. I checked that NotificationID should be a link (expecting that to be the "selected item" column with the primary key for that row). Then I make my dynamic URL with a macro, I used {% CurrentUrl + NotificationID %} and the NotificationID value is always returned as 0.
When I looked in the custom table datagrid webpart code it is hard coded to look for the "ItemID" field vs. the custom table's primary key, which could be dynamically populated with the 2 simple lines of code
IDataClass idc = DataClassFactory.NewDataClass(CustomTable);
int itemId = ValidationHelper.GetInteger(DataHelper.GetDataRowViewValue((DataRowView)e.Item.DataItem, idc.IDColumn), 0);
Second part which isn't so much of a bug but more of a hassle is the URL parameter. The URL parameter is hard coded to append with the key of "id". This should be an additional property the user can specify, with a default of "id" if not populated. Then I can hook it up to other web parts and use the URL parameter key of my choice.