Use cWebView.pkg Use cWebPanel.pkg Use cWebForm.pkg Use cCustomerDataDictionary.DD Use csfWebList.pkg Use csfWebColumn.pkg Use cJsonObject.pkg Use cWebButton.pkg Object oSyncFusionGridCustomerListManually is a cWebView Set psCaption to "SyncFusion Grid manually load data from Customer table" Set pbServerOnShow to True // must be set for OnShow to fire // Your DDO structure will go here Object oCustomer_DD Is a cCustomerDataDictionary End_Object Set Main_DD to oCustomer_DD Set Server to oCustomer_DD Object oWebMainPanel is a cWebPanel Set piColumnCount to 12 // place controls here. // Your view will grow as controls are added Object oForm is a cWebForm Set psLabel to "Label 1:" Set piColumnSpan to 2 End_Object Object oDeleteWebButton is a cWebButton Set psCaption to "Delete" Set piColumnIndex to 2 Set psToolTip to "Delete the currenctly selected row" Procedure OnClick Integer iRow WebGet piCurrentRowIndex of oCustomerWebList to iRow If (iRow > -1) Begin Send DeleteRowByIndex of oCustomerWebList iRow End Else Begin Send ShowInfoBox "No row is currently selected." End End_Procedure End_Object Object oUpdateWebButton is a cWebButton Set psCaption to "Update" Set piColumnIndex to 3 Set psToolTip to "Update the currently selected row with our own data" Procedure OnClick Integer iRow Handle hoJSON hoRow WebGet piCurrentRowIndex of oCustomerWebList to iRow If (iRow > -1) Begin Get Create (RefClass(cJsonObject)) to hoJSON Send InitializeJsonType of hoJSON jsonTypeArray Get Create (RefClass(cJsonObject)) to hoRow Send InitializeJsonType of hoRow jsonTypeObject Send SetMemberValue Of hoRow "Number" jsonTypeInteger 108 Send SetMemberValue of hoRow "Name" jsonTypeString "John Fogerty" Send SetMemberValue of hoRow "State" jsonTypeString "CC" Send SetMemberValue of hoRow "Zip" jsonTypeString "112233" Send SetMemberValue of hoRow "Status" jsonTypeBoolean True Send AddMember of hoJSON hoRow Send Destroy of hoRow Send UpdateRowByIndex of oCustomerWebList iRow hoJson Send Destroy Of hoJson End Else Begin Send ShowInfoBox "No row is currently selected." End End_Procedure End_Object Object oInsertWebButton is a cWebButton Set psCaption to "insert" Set piColumnIndex to 4 Set psToolTip to "Insert a new row of data before the selected row" Procedure OnClick Integer iRow Handle hoJSON hoRow WebGet piCurrentRowIndex of oCustomerWebList to iRow If (iRow > -1) Begin Get Create (RefClass(cJsonObject)) to hoJSON Send InitializeJsonType of hoJSON jsonTypeArray Get Create (RefClass(cJsonObject)) to hoRow Send InitializeJsonType of hoRow jsonTypeObject Send SetMemberValue Of hoRow "Number" jsonTypeInteger 103 Send SetMemberValue of hoRow "Name" jsonTypeString "Alice Cooper" Send SetMemberValue of hoRow "State" jsonTypeString "NY" Send SetMemberValue of hoRow "Zip" jsonTypeString "235546" Send SetMemberValue of hoRow "Status" jsonTypeBoolean True Send AddMember of hoJSON hoRow Send Destroy of hoRow Send InsertRowByIndex of oCustomerWebList iRow hoJson Send Destroy Of hoJson End Else Begin Send ShowInfoBox "No row is currently selected." End End_Procedure End_Object Object oAddWebButton is a cWebButton Set psCaption to "add" Set piColumnIndex to 5 Set psToolTip to "Add a new row of data at the end of the list" Procedure OnClick Handle hoJSON hoRow Get Create (RefClass(cJsonObject)) to hoJSON Send InitializeJsonType of hoJSON jsonTypeArray Get Create (RefClass(cJsonObject)) to hoRow Send InitializeJsonType of hoRow jsonTypeObject Send SetMemberValue Of hoRow "Number" jsonTypeInteger 199 Send SetMemberValue of hoRow "Name" jsonTypeString "Jimi Hendrix" Send SetMemberValue of hoRow "State" jsonTypeString "FL" Send SetMemberValue of hoRow "Zip" jsonTypeString "9999" Send SetMemberValue of hoRow "Status" jsonTypeBoolean False Send AddMember of hoJSON hoRow Send Destroy of hoRow Send AddRow of oCustomerWebList hoJson Send Destroy Of hoJson End_Procedure End_Object Object oCustomerWebList is a csfWebList Set piColumnIndex to 0 Set piColumnSpan to 12 Set piHeight To 400 Set pbAllowSorting To True Set pbAllowPdfExport To True Set pbAllowExcelExport To True Set pbShowToolBar To False Set peDbGridType to gtManual Set pbDataAware to False Object oCustomer_Customer_Number is a csfWebColumn Set psCaption To "Number" Set psField To "Number" // The Fields must match up with the names of the rows in the JSON Set piWidth to 50 End_Object Object oCustomer_Name is a csfWebColumn Set psCaption to "Customer Name" Set psField To "Name" Set piWidth to 196 End_Object Object oCustomer_State is a csfWebColumn Set psCaption to "St." Set psField To "State" Set piWidth to 77 End_Object Object oCustomer_Zip is a csfWebColumn Set psCaption to "Zip" Set psField To "Zip" Set piWidth to 71 End_Object Object oCustomer_Status is a csfWebColumnCheckbox Set psCaption to "Active?" Set psField To "Status" Set piWidth to 50 End_Object // load customized static data into the datasource. This shows how you can populate a DEO grid // with custom data which bypasses the normal cached / constrained finding the datasource // normally does. Procedure LoadCustomerData Handle hoServer hoJSON hoRow Boolean bFound Integer iFile //String sJson Get Create (RefClass(cJsonObject)) to hoJSON Send InitializeJsonType of hoJSON jsonTypeArray Get Main_DD to hoServer Get Main_File of hoServer to iFile Send Request_Read of hoServer FIRST_RECORD iFile 1 Move (Found) to bFound While bFound Get Create (RefClass(cJsonObject)) to hoRow Send InitializeJsonType of hoRow jsonTypeObject If (Customer.State<>"CA") Begin // creates a datasourcerow based on current buffer data // // Not required to add a rowid as our library will add it automatically. //Send SetMemberValue of hoRow "_rid" jsonTypeString (String(Customer.Recnum)) Send SetMemberValue Of hoRow "Number" jsonTypeInteger Customer.Customer_Number Send SetMemberValue of hoRow "Name" jsonTypeString (Rtrim(Customer.Name)) Send SetMemberValue of hoRow "State" jsonTypeString (Rtrim(Customer.State)) Send SetMemberValue of hoRow "Zip" jsonTypeString (Rtrim(Customer.Zip)) Send SetMemberValue of hoRow "Status" jsonTypeBoolean (If((Rtrim(Customer.Status))="Y",True,False)) Send AddMember of hoJSON hoRow End Send Destroy of hoRow Send Request_Read of hoServer GT iFile 1 Move (Found) to bFound Loop Send LoadJSONData hoJson Send Destroy Of hoJson End_Procedure Procedure OnChangeCurrentRow String sFromRowID String sToRowID send none End_Procedure Procedure OnLoad Forward Send OnLoad Send SetActionMode (RefProc(ConfigureGrid)) scModeProgress "Loading Data.." End_Procedure End_Object End_Object Procedure OnShow Forward Send OnShow Send LoadCustomerData Of oCustomerWebList End_Procedure End_Object