ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

fullRowEdit

Open molecular opened this issue 10 years ago • 22 comments

Is it possible to switch a whole row into "edit mode" (each cell should show the editableCellTemplate).

I have seen people suggest using cellTemplates with switching cells to their edit controls via a flag on the rows. That seems cumbersome and error-prone to me. Is there a cleaner solution?

I would ideally like to use such a feature either in conjunction with ui-grid-row-edit or with explicit "edit", "save", "revert" buttons for/on the individual rows.

I would be very thankfull for any hint on how I could tackle this problem. I've been working with ui-grid for a good while now, but so far I haven't come to realize a good solution for this problem. This is one of the last barriers (apart from a good integration of ui-bootstrap uib-datepicker and uib-timepicker, which I'm working on with some progress) keeping me from using my beloved ui-grid in the project I currently develop.

molecular avatar Jun 22 '16 12:06 molecular

@molecular I came across the same issue, I ended up with custom implementation (by changing library for some extent). Final output looks like

image

msrikanth508 avatar Jun 22 '16 12:06 msrikanth508

awesome! looks exactly like what I had in mind.

any chance to get the code?

molecular avatar Jun 22 '16 14:06 molecular

If there isn't a chance for code, could you give a rough outline on how you implemented your solution?

molecular avatar Jun 23 '16 05:06 molecular

There was already a similar issue, see #3122

jonathan-weiss avatar Jun 23 '16 07:06 jonathan-weiss

@molecular, To implement this feature, I have

  • Injected custom edit control column in column definitions and bound custom events for edit controls
  • I have created custom row entity object to carry all required flags such as isEdited, isSaved, isCanceled
  • And, injected custom service into "uiGridCell" directive to fill required information like original cell value
  • When we click on "Edit" icon I'm enabling all row entity objects with isEdited:true and changing row cellTemplate to editTemplate

Hope this will help you. I will create small POC in plunker and provide to you. Thanks

msrikanth508 avatar Jun 23 '16 12:06 msrikanth508

srikanth can you please provide the UI GridInline Edit JS. The below JS is miss

https://rawgit.com/msrikanth508/uiGridInlineEditPOC/master/Js/vendor/ui-grid.js

This URL is not accessible anymore.

komalgithub avatar Jun 23 '16 17:06 komalgithub

or probably molecular if you have the source code for inline editing of ui grid can you provide me

komalgithub avatar Jun 23 '16 18:06 komalgithub

Please srikanth can you provide the JS as i am using it, let me know is there a way you can share the code

komalgithub avatar Jun 23 '16 18:06 komalgithub

@molecular/ @komalgithub it is up and accessible now. Code is available here: https://github.com/msrikanth508/uiGridInlineEditPOC

NOTE: This is just POC, this will help to draw some idea out of it. In implementation part, we could remove cell watches and achieve same behavior. I had done in my project without using watches, unfortunately I cannot share the file which has recent changes (as shown in above image) because I made couple of other changes in source file to implement other custom features.

msrikanth508 avatar Jun 24 '16 06:06 msrikanth508

Thank you Srikanth for providing the JS, however i see that the Delete button is not working in this code

komalgithub avatar Jun 24 '16 12:06 komalgithub

When clicking on Delete it takes into editable mode with Update, Cancel buttons in the old POC it was working fine.

komalgithub avatar Jun 24 '16 12:06 komalgithub

You can ignore than srikanth, got it to work

komalgithub avatar Jun 24 '16 12:06 komalgithub

@msrikanth508 thank you 1000 for uiGridInlineEditPOC! I will evaluate soon.

molecular avatar Jun 24 '16 14:06 molecular

@molecular / @komalgithub I’m glad you found it useful.

msrikanth508 avatar Jun 27 '16 04:06 msrikanth508

@msrikanth508 Thank you tons for inline editing in ui grid, its really helpful...

komalgithub avatar Jun 27 '16 14:06 komalgithub

@msrikanth508 : Your version of inline editing doesn't work with grouping. It starts breaknig because grouping inserts a header row and it couldn't find 'IsEdit' property on the header row. I tried to look but doesn't have much idea how to solve it. Can you give some pointers or is it already handled in other version you are using in your project

devanshuGit avatar Aug 09 '16 14:08 devanshuGit

msrikanth508 : I am using inline editing grid, i have a requirment where i want to hide some text in edit mode like i show some hyperlink on the text which i do not want in edit mode, can you please let me know how to achieve this?

komalgithub avatar Oct 17 '16 22:10 komalgithub

@komalgithub : see following cell template

<div class="ui-grid-cell-contents">
   <i class="glyphicon glyphicon-edit" ng-if="!row.inlineEdit.isEditModeOn" ng-click="row.inlineEdit.enterEditMode($event)"/>
</div>

This is an "edit" icon we have in first column of a grid. It's hidden when edit mode is active. Wehn clicked, row edit mode is activated.

Does this help?

EDIT: I'm not 100% sure this will work in your version. We have made some modifications and I'm not sure if any of them are needed for this to work.

molecular avatar Oct 19 '16 14:10 molecular

Does it work with last version of UI-grid ?

lbogdan4 avatar Aug 04 '17 15:08 lbogdan4

don't know, hoping to not have to that try anytime soon, either. Has there been major changes? I'm out of the loop on ng-grid. Anyone try this recently?

molecular avatar Aug 05 '17 12:08 molecular