Hii everyone
how to inserted data in CDT from editable grid?
Discussion posts and replies are publicly visible
You haven't provided much useful detail here - like, for instance, what you're trying to accomplish, or what (if anything) you've already tried. Can you please elaborate?
I have created an editable grid with some fields(firstname ,lastname,address,email) I want the data to be entered through the grid in my table.
And in what way, specifically, is it not working?
I want to enter new data using grid then how to save that data in my table(CDT).
editable grid code given below:
a!localVariables( local!employees: rule!ED_GetEmployeeData(), a!formLayout( label: "Employee Details: Add,Update, or Remove Employee Data", contents: { a!gridLayout( totalCount: count(local!employees), headerCells: { a!gridLayoutHeaderCell(label: "First Name" ), a!gridLayoutHeaderCell(label: "Last Name" ), a!gridLayoutHeaderCell(label: "Email" ), a!gridLayoutHeaderCell(label: "ContactNumber" ), a!gridLayoutHeaderCell(label: "Designation" ), a!gridLayoutHeaderCell(label: "Department" ), a!gridLayoutHeaderCell(label: "Address" ), a!gridLayoutHeaderCell(label: "City" ), a!gridLayoutHeaderCell(label: "State" ), a!gridLayoutHeaderCell(label: "Country" ), a!gridLayoutHeaderCell(label: "Gender" ), a!gridLayoutHeaderCell(label: "Date of joining" ), /* For the "Remove" column */ a!gridLayoutHeaderCell(label: "" ) }, /* Only needed when some columns need to be narrow */ columnConfigs: { a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:3 ), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight:2 ), a!gridLayoutColumnConfig(width: "ICON") }, /* * a!forEach() will take local!employee data and used that data to loop through an * expression that creates each row. * * When modifying the recipe to work with your data, you only need to change: * 1.) the number of fields in each row * 2.) the types of fields for each column (i.e. a!textField() for text data elements) * 3.) the fv!item elements. For example fv!item.firstName would change to fv!item.yourdata */ rows: a!forEach( items: local!employees, expression: a!gridRowLayout( id: fv!index, contents: { /* For the First Name Column*/ a!textField( /* Labels are not visible in grid cells but are necessary to meet accessibility requirements */ label: "First Name " & fv!index, value: fv!item.FirstName, saveInto: fv!item.FirstName, required: true ), /* For the Last Name Column*/ a!textField( label: "last name " & fv!index, value: fv!item.lastName, saveInto: fv!item.lastName, required:true ), /* For the Email Column*/ a!textField( label: "Email " & fv!index, value: fv!item.Email, saveInto: fv!item.Email, required:true ), /* For the Contact Number Column*/ a!textField( label: "ContactNumber " & fv!index, value: fv!item.ContactNumber, saveInto: fv!item.ContactNumber, required:true ), /* For the Designation Column*/ a!dropdownField( label: "Designation " & fv!index, placeholder: "-- Select -- ", choiceLabels:{"Software Engineer","Support Engineer","Tester","Marking Specialist","Web Developer",".Net Developer","Graphic Designer"}, choiceValues:{"Software Engineer","Support Engineer","Tester","Marking Specialist","Web Developer",".Net Developer","Graphic Designer"}, value: fv!item.Designation, saveInto: fv!item.Designation, required:true ), /* For the Department Column*/ a!dropdownField( label: "department " & fv!index, placeholder: "-- Select -- ", choiceLabels: { "Corporate", "Engineering", "Finance", "Human Resources", "Professional Services", "Sales" }, choiceValues: { "Corporate", "Engineering", "Finance", "Human Resources", "Professional Services", "Sales" }, value: fv!item.department, saveInto: fv!item.department, required:true ), /* For the Address Column*/ a!textField( label: "Address " & fv!index, value: fv!item.Address, saveInto: fv!item.Address, required:true ), /* For the City Column*/ a!dropdownField( label: "City " & fv!index, placeholder: "-- Select City-- ", choiceLabels: {"Delhi","Assam","Bihar","Arunachal Pradesh","Gujarat", "Uttar Pradesh"}, choiceValues:{"Delhi","Assam","Bihar","Arunachal Pradesh","Gujarat", "Uttar Pradesh"}, value: fv!item.City, saveInto: fv!item.City, required:true ), /* For the State Column*/ a!dropdownField( label: "State " & fv!index, placeholder: "-- Select State-- ", choiceLabels: {"Delhi","New Delhi","Bettiah","Jamalpur","Ahmadabad","Agra","Aligarh"}, choiceValues: {"Delhi","New Delhi","Bettiah","Jamalpur","Ahmadabad","Agra","Aligarh"}, value: fv!item.State, saveInto: fv!item.State, required:true ), /* For the Country Column*/ a!dropdownField( label: "Country " & fv!index, placeholder: "-- Select Country-- ", choiceLabels:{"India","Russia","USA","Germany","Austriala"}, choiceValues:{"India","Russia","USA","Germany","Austriala"}, value: fv!item.Country, saveInto: fv!item.Country, required:true ), /* For the Gender Column*/ a!textField( label: "Gender" & fv!index, value: fv!item.Gender , saveInto: fv!item.Gender ), /* For the Hire Date Column*/ a!dateField( label: "Date of Joining " & fv!index, value: fv!item.Hire_Date, saveInto: fv!item.Hire_Date, required:true, align: "RIGHT" ), /* For the Removal Column*/ a!richTextDisplayField( value: a!richTextIcon( icon: "trash-o", altText: "delete " & fv!index, caption: "Remove " & fv!item.firstName & " " & fv!item.lastName, link: a!dynamicLink( value: fv!index, saveInto: { a!save(local!employees, remove(local!employees, save!value)) } ), linkStyle: "STANDALONE", color: "NEGATIVE" ) ) } ) ), addRowlink: a!dynamicLink( label: "Add Employee", /* * For your use case, set the value to a blank instance of your CDT using * the type constructor, e.g. type!Employee(). Only specify the field * if you want to give it a default value e.g. startDate: today()+1. */ value: { startDate: today() + 1 }, saveInto: { a!save(local!employees, append(local!employees, save!value)) } ), rowHeader: 1 ) }, buttons: a!buttonLayout( primaryButtons: a!buttonWidget( label: "Submit", submit: true ) ) ))
jojog0002 said:a!buttonWidget( label: "Submit", submit: true )
saveInto: { a!save(ri!employeeList, local!employees)}