[Dojo-interest] dgrid editOn button click to edit/save/del row

Jean-Claude Hujeux jchujeux at gmail.com
Mon Feb 1 03:57:54 EST 2016


Oops! You're perfectly right, and I may have misunderstood Simon's
sentence:  "this will enable all the editors for each cell".

I thought he was looking for all editor widgets to show-up only for the
cells of the current row when he clicks on his corresponding "edit"
button for the row.

Editor widgets in a dgrid either always show-up for all rows of a column
(column "Time" in the specific example you point to), or for the
currently focused  cell only (column "Select Options" in the example),
depending on the value of the "editOn" flag for the column. This is what
I meant.

Rgds,
jc

Le 01/02/2016 09:16, Shahzad Bhatti a écrit :
> It is perfectly normal to have all cells of a row editable in dgrid 
> check these example http://dgrid.io/js/dgrid/test
> more specifically http://dgrid.io/js/dgrid/test/Editor_more_widgets.html
>
> Regards
> Shahzad
>
> On Mon, Feb 1, 2016 at 1:04 PM, Jean-Claude Hujeux <jchujeux at gmail.com
> <mailto:jchujeux at gmail.com>> wrote:
>
>     I don't have experience in making all cells of a row editable at
>     once (not sure this is doable, and anyway one edits only one cell
>     at a time). For the rest, I've done something similar to what
>     you're looking for, using context menus over the cells (headers
>     and rows) rather than a reserved column with action buttons. As
>     Shahzad says, there are many ways to do this. Here is an outline
>     of how I went about this:
>
>       * I needed to retrieve the current row and cell, for this I use
>         the following:
>
>                 grid.on(".dgrid-row:mousedown,
>     .dgrid-header:mousedown, dgrid-editor-show", lang.hitch(grid,
>     grid.mouseDownCallback));
>                 ...
>                 mouseDownCallback: function(evt){
>                     this.clikedRow = this.row(evt);
>                     this.clickedCell = this.cell(evt);
>                     ...
>                 }
>
>         This way, grid.clickedRow and grid.clickedCell are always
>         current and available in the context menu callback functions:
>         grid.addRow() grid.addSubRow(), grid.deleteRow().
>
>       * changes made by the user end up in grid.dirty. Rows add /
>         delete take place in grid.collection.
>           o I keep grid.dirty and grid.collection "in-sync": when I
>             add a row in grid.collection, I add the same row in
>             grid.dirty (same idProperty value). When I delete a row in
>             grid.collection, I delete it also in grid.dirty, and I
>             keep separately an array of all idProperty values that
>             were deleted (grid.deleted).
>           o I do a grid.refresh({keepScrollPositon: true}) every time
>             I have added / deleted a row
>           o for now I restrict myself to memory dstores (and then
>             using grid.collection.addSync / grid.collection.removeSync)
>       * save / reset (cancel changes) are not handled at the row level
>         but at the grid level (buttons above the grid):
>           o grid.dirty and grid.deleted contain all the changes that
>             were made: if they are empty, no change was made, else I
>             send those changes to the server.
>           o for reset I get the original collection back from the server
>
>     Hope this helps,
>     jc
>
>
>
>     Le 29/01/2016 08:16, Simon Walter a écrit :
>>     OK, I will keep hacking and post some code when I think it should
>>     work.
>>
>>     On 2016/01/29 16:12, Shahzad Bhatti wrote:
>>>     Alright, there are like many ways to do that...as far as my
>>>     understanding goes, i think pretty simple way would be to use
>>>     onChange event from customEditor, 
>>>
>>>     for example you can set keys against operations 
>>>
>>>     on add click you can call onChange with 1, for for edit 2 and
>>>     for save 3...
>>>
>>>     like this saveButton.on('click',function(){
>>>        self.onChange(3);
>>>     });
>>>
>>>     and you can capture this on change using dgrid-datachange event
>>>     and process information as you like. Or like i showed in example
>>>     you can just directly call grid.save() once save is clicked and
>>>     values will be pushed to whatever store you have.
>>>
>>>
>>>     Another way i will recommend you to take a look at renderCell
>>>     function of column you can also use that instead of customEditor
>>>     to make these operation buttons and hence manipulate grid as you
>>>     like.
>>>
>>>
>>>
>>>     Thanks
>>>     Shahzad
>>>
>>>
>>>     On Fri, Jan 29, 2016 at 11:45 AM, Simon Walter <simon at gikaku.com
>>>     <mailto:simon at gikaku.com>> wrote:
>>>
>>>         I can't understand how to use editorArgs to accomplish this.
>>>         Can I have a hint please?
>>>
>>>         Someone has asked the same question here:
>>>         http://stackoverflow.com/questions/13027345/dojo-dgrid-multiple-cells-edit
>>>
>>>         I would assume this is not only possible, but a fairly
>>>         common use case. It could be that I am too stupid to see the
>>>         obvious. ;)
>>>
>>>         Simon
>>>
>>>
>>>         On 2016/01/27 20:58, Shahzad Bhatti wrote:
>>>>         ohh it's a save button, i guess you can do that using some
>>>>         call back inside editorArgs.
>>>>
>>>>         Shahzad
>>>>
>>>>         On Wed, Jan 27, 2016 at 8:00 AM, Simon Walter
>>>>         <simon at gikaku.com <mailto:simon at gikaku.com>> wrote:
>>>>
>>>>             Hi all,
>>>>
>>>>             I've been playing around with the dgrid - only having
>>>>             shallowly used
>>>>             DataGrid. I've seen some questions on this mailing list
>>>>             pertaining to
>>>>             dgrid. If I should ask elsewhere please let me know.
>>>>
>>>>             So it's a basic use case that I've seen all over the
>>>>             web. I need an
>>>>             editable grid. I would like to have the last
>>>>             (right-most) column have
>>>>             buttons respective to the row for editing (this will
>>>>             enable all the
>>>>             editors for each cell), save (this will trigger the
>>>>             save function of the
>>>>             dstore), and delete (also deals with the dstore). An
>>>>             add button that
>>>>             adds an empty row to be edited to the dstore would be
>>>>             nice too. I might
>>>>             try to tackle that after I get the above working.
>>>>
>>>>             I'm not really sure where to begin. I think I would
>>>>             emit an event, but
>>>>             then how does the editor know that the event emitted is
>>>>             on it's row?
>>>>
>>>>             I don't have any working code, other than a basic
>>>>             OnDemandGrid with
>>>>             editor mixin and some dijits showing up when I click
>>>>             the cell - all very
>>>>             nice and simple.
>>>>
>>>>             The closest example I can find now is something made
>>>>             with JQuery, but I
>>>>             don't want to use JQuery just for this when the rest of
>>>>             the site is
>>>>             using Dojo.
>>>>             (http://www.trirand.com/jqgridwiki/doku.php?id=wiki:inline_editing)
>>>>             Or
>>>>             maybe this is a good example:
>>>>             (http://demos.telerik.com/kendo-ui/grid/editing-inline)
>>>>
>>>>             Can I please have some guidance on how to best realize
>>>>             this "buttons per
>>>>             row" requirement I have?
>>>>
>>>>             Kind regards,
>>>>
>>>>             Simon
>>>>             --
>>>>             Dojo Toolkit: http://dojotoolkit.org/
>>>>             Tutorials: http://dojotoolkit.org/documentation/
>>>>
>>>>             Dojo-interest at mail.dojotoolkit.org
>>>>             <mailto:Dojo-interest at mail.dojotoolkit.org>
>>>>             To unsubscribe, visit:
>>>>             http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>         --
>>>         Dojo Toolkit: http://dojotoolkit.org/
>>>         Tutorials: http://dojotoolkit.org/documentation/
>>>
>>>         Dojo-interest at mail.dojotoolkit.org
>>>         <mailto:Dojo-interest at mail.dojotoolkit.org>
>>>         To unsubscribe, visit:
>>>         http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>>>
>>>
>>>
>>>
>>
>>
>>
>
>
>     --
>     Dojo Toolkit: http://dojotoolkit.org/
>     Tutorials: http://dojotoolkit.org/documentation/
>
>     Dojo-interest at mail.dojotoolkit.org
>     <mailto:Dojo-interest at mail.dojotoolkit.org>
>     To unsubscribe, visit:
>     http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-interest/attachments/20160201/c368cfa9/attachment-0001.htm 


More information about the Dojo-interest mailing list