
Security News
Opengrep Adds Apex Support and New Rule Controls in Latest Updates
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
react-mvc-datatable
Advanced tools
Intead of repetitve copy-paste I made myself a library that helps up to build pages that contains DataTable elements.
npm i react-mvc-datatable
Create the needed entity that extends Entity
Example:
export interface User extends Entity {
username?: string;
email?: string;
available?: boolean;
}
Example:
export default class MyDemoTable extends DataTable<User> {
buildDialog(): DialogConfig<User> {
return {
title: (isEdit) => (isEdit ? "Edit User" : "Add User"),
submitText: (isEdit) => (isEdit ? "Save Changes" : "Create User"),
validate: (item) => {
const errors: Record<string, string> = {};
if (!item.email) errors.username = "The email is required"
if (!item.available) errors.available = "The availability is required"
return { isValid: Object.keys(errors).length === 0, errors };
},
fields: [
{
name: "username",
label: "Username",
required: false,
autoFocus: false
},
{
name: "email",
label: "Email",
required: true,
autoFocus: false
}
{
name: "available",
label: "Is Available",
type: "checkbox",
required: true,
autoFocus: false
}
]
}
}
buildColumns(): GridColDef[] {
return [
{
field: "username",
headerName: "Username",
flex: 1
},
{
field: "email",
headerName: "Email",
flex: 1
},
{
field: "actions",
type: "actions",
headerName: "Actions",
width: 100,
getActions: (params) => [
<GridActionsCellItem
icon={<EditIcon />}
label="Edit"
onClick={() => this.handleEdit(params.row)}
/>,
],
},
]
}
getConfig(): DataTableConfig<User> {
return {
title: 'Users',
columns: this.buildColumns(),
addButtonLabel: "Add new user",
pageSizeOptions: [5, 10, 20, 100],
defaultPageSize: 20,
initialRows: [mockUser],
dialogConfig: this.buildDialog()
}
}
handleSubmit(item: User): Promise<void> {
// Your save logic here - this would typically call an API
return new Promise((resolver) => {
setTimeout(() => {
// ID exists, apply update operations
if (item.id) {
console.log("Updating employee :", item);
} else {
// ID does NOT exist, add new entry
console.log("Saving employee:", item);
}
})
})
}
}
export const mockUser: User = {
id: 1,
email: "user@info.com",
username: "user",
available: false
}
✅ Start using it, give feedback! ✅ Contributions are welcome
react-mvc-datatable is licensed under the MIT license. See the LICENSE file for details.
FAQs
A reusable MUI-based abstract datatable for React apps
We found that react-mvc-datatable demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.