Skip to Content
avatar image
Former Member

How to achive multi-line editing (CRUD) with a table-UI on a ejb-model

Hello community,

i'm working on an prototype. we want to migrate an existing web-application to nw 7.1 with web-dynpro as ui-technology. the old application often uses javascript-/ajax- driven table-grid-controls. this table controls allowed editing the data in it. the conrol "records" every action. for example which rows were deleted, which were updated and which were appended.

when the user has finished editing, he simply clicks a save-button. the table-grid control then sends the changes via ajax-calls to the server.

now i want the achive such behavior in web-dynpro (7.1)

for getting the data to be edited, i wrote an ejb and created an ejb-model in web-dynpro. so viewing the data works fine so far. the view-controller with the table-ui-element is bound to the view-controllers context, which is mapped to the context-controller to which again a model-object is bound, which retrieves the data from the ejb.

inserting, updating and deleting single rows with a detail-view-controller also works, using additional context nodes (again mapped to addtional model-classes for crudp.

but i know want to have all rows and cells to be editable. the user should be able to insert, update and delete in that table without neccessarily using a detail-view-controller.

how would you achive this? holding every creates, update, deletes in single nodes? and when clicking a button to fire the save action to go to that nodes and apply that action? Or would you create an addtional flag-attribute in the node that shows what was done with that row? after pressing save also iterating the nodes, checking for the flag and doing the appropriate actions (but this maybee is performance critical when having a lot of rows)?

any ideas how to achieve multiple crud-operations on a context-node, viewed with a table-ui-element would be welcome.



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 01, 2008 at 07:28 PM


    Let's address your questions one by one.

    1. You can make the table cells editable by chosing 'InputField' as TableCellEditor.

    2. Since you have bound your table to 'View Context' and 'View Context' to 'Component Context', all changes made by you in table will be visible in Component Context after every round-trip to server.

    3. To modify the data in 'backend', you need to modify your 'Save' method to check for every changed element and modify the data only if element was changed by user. To see if the element has been changed by user, use [IWDNodeElement.isChangedByClient()|] method. This method returns true if element was changed by user - this is what you need.

    To learn more about WD Table UI element, you may want to see [this link|].

    Hope this helps.


    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 15, 2008 at 08:59 AM

    Hello everybody,

    the posts helped going the right way but were not the complete solution.

    in the meantime i found a solution for the last steps of my question myself.

    for updating the data in a table-ui i have an save-button which triggers an action.

    that action loops over the node bound to the table and checks each element if it was changed.

    but to modify the data in the backend i also now use a model-class. that class is getting the data of the row (a complete object) as parameter and a flag if the data of the element is to be inserted, updated or to delete from the database. I dont have single insert-, update, delete-model-classes for the background-ejbs and only used one crud-method in order to have less model-classes used by my web-dynpro-Application.

    after excetuing that model-class for the background ejb for modifying the database, i simple insert oder delete that modified element to/from the node.



    Add comment
    10|10000 characters needed characters exceeded