I have a database table that is based on this model:
1.
public
partial
class
ClientTableRow
2.
{
3.
public
Guid Id {
get
;
set
; }
4.
public
Guid TableId {
get
;
set
; }
5.
public
Guid UserId {
get
;
set
; }
6.
public
string
RowData {
get
;
set
; }
7.
public
DateTimeOffset CreatedOn {
get
;
set
; }
8.
}
The RowData contains JSON.
The API call which retrieves the data, usually by TableId, modifies the JSON somewhat by adding the record's "Id" and "CreatedOn" fields. The following javascript gives me much of what I want:
1.
$.get(
'/Data/GetJsonData/'
+ tableId,
function
(data) {
2.
var
gridName =
'#'
+ tableId +
'-grid'
;
3.
var
grid = $(gridName).kendoGrid({
4.
dataSource: data,
5.
selectable:
true
,
6.
sortable:
true
7.
});
8.
});
Visually the grid looks good except for the fact that Id show up in the grid... and since it is a Guid consumes a screen space.
There are 3 goals I'd like to achieve.
- I would like to make this grid editable. However, all the examples I've seen on the demo site have fixed, known fields when they are creating the schema in the datasource as well as defining the columns in the grid.
- I'd like to hide the Id. I know I will need it for editing, deleting, and some other tasks mentioned briefly below.
- I'd like to add a "Command" column with edit and delete, as well command to pull further related data based on the record Id.
Is there a way to achieve these goals with the fact that we won't know what the Json data looks like? The only fields that will ever be consistent are the Id and the CreatedOn date since they are attached to the Json before it's sent to the grid. (It *is* safe to assume that all Json data with the same TableId are similar.)