SilkBuilder
  • SilkBuilder
  • Development Environment
    • Development Environment
    • System Elements
    • Project, Data Model and ORM
    • Development Formats
  • Silk Builder Training
    • Sample Database
    • Plain Application
    • Easy Application
    • Simple Application
    • Complex Application
    • Report Application
    • System Environment
  • Docs
    • The ORM Structure
    • SilkBuilder
    • Silk Service
    • Java Database Class
    • Report
  • Silk Tags
    • App
    • AppHeader
    • Button
    • ButtonItem
    • Chart
    • Column
    • Content
    • DataProvider
    • DataService
    • Form
    • Group
    • Header
    • HelpBox
    • If
    • Input
    • JQcode
    • JScode
    • LogicAction
    • LogicDimension
    • LogicGrid
    • Modal
    • ModalBody
    • ModalFooter
    • Module
    • Page
    • Pagination
    • Screen
    • ScreenFooter
    • ScreenHeader
    • Tab
    • TabItem
    • Table
    • TableBody
    • TableHeader
    • TabsNav
    • Tile
  • JavaScript Objects
    • Button
    • ChartJS
    • Column
    • DataProvider
    • EventManager
    • Form
    • Input
    • Modal
    • Pagination
    • SilkPage
    • Table
    • TabsNav
    • Tile
    • Utility Functions
  • Coding Techniques
    • Data Trees
    • Pagination
    • Mark Deleted
    • Record Sync
    • Filtering Code
    • Content Template
    • Sort Data Columns
    • Form Input File
    • Button with Confirmation
    • Toggle List
    • Table Inputs
Powered by GitBook
On this page
  • The markDeleted Property
  • ORM Triggers
  1. Coding Techniques

Mark Deleted

When SilkBuilder receives a request to remove a record from the database, it executes the SQL command "delete," which physically removes it. However, there are cases in which a record has to be "removed" from the application operations but still exists in the database for archiving or log purposes. To accomplish this kind of scenario, the silk:DataProvider tag provides the property markDeleted.

The markDeleted Property

By default, when not added, the markDeleted property value is "false." In this case, the DataProvider will execute a regular delete SQL command. If the property markDelete value is set to "true," then the DataProvider will execute a "delete" on the client side for visual feedback and an "update" in the server side.

<silk:DataProvider id="dataDP" servicePath="" markDeleted="true" />

To complete this process, the DataProvider has to be "informed" of which column, or columns, defines the removal of the record. To do this SilkBuilder provides the DataProvider event markDeleted. This event is triggered before the delete method is executed. Using the method setOperationsItem, the column, or columns, defining the record deletion can be set up.

dataDP.on("markDeleted",function(){
	/*
	 * In this example the column 'archiveStatus' defines
	 * in the table the 'deleted' condition.
	 * The value 0 is not-deleted, and 1 is deleted.
	 */
	dataDP.setOperationItem("archiveStatus",1);
});

ORM Triggers

Even though the markDeleted="true" property will execute an update in the database, the ORM will still execute a before delete and/or after delete triggers if these had been configured.

PreviousPaginationNextRecord Sync

Last updated 1 year ago