Title: Datagrid Append getting data from previous row [solved] Post by: devnull on May 14, 2013, 09:05:17 PM Hi;
For certain columns, I need to get the column.value from the previous row when appending a new row. Any suggestions on how this can be done from within data-options > columns > field ? Thanks Title: Re: Datagrid Append getting data from previous row Post by: stworthy on May 14, 2013, 11:34:44 PM Call 'getColumnOption' method to get a specified column's option which contains your customized value.
Code: <th data-options="field:'name',value:'abc',..."> Code: var col = $('#dg').datagrid('getColumnOption', 'name'); Title: Re: Datagrid Append getting data from previous row Post by: devnull on May 15, 2013, 12:18:04 AM Thanks so much for helping, appreciate your patience !
I didn't explain very weel, is it possible to do this using code inside the column definition, maybe by using a custom editor something like this: Code: {field:'SEQUENCE_NO',title:'Sequence',editor: {type:text, function(){return $(this).datagrid('getRows')[index -1].value;}} }, I want to pull the value from the previous row and have the option to overwrite the value. Title: Re: Datagrid Append getting data from previous row Post by: stworthy on May 15, 2013, 08:12:20 PM Don't clearly know what you want to do. If want to set the column's customized value when end editing a row, try the code below:
Code: // extend your custom text editor Apply the 'customtext' editor to a column. Code: <th data-options="field:'attr1',width:250,editor:{ Title: Re: Datagrid Append getting data from previous row Post by: devnull on May 15, 2013, 10:04:45 PM Hi;
See attached screen shot. When a new row is inserted, I want to get the "Seq No" value from the previous row and add 10 to it. The previous Seq No was 60, and so this row would default to 70 (previous + 10), however the user could override this default if they wanted to. But the problem is that I need to be able to do this from the table column definition and not by using a custom on-insert function. Title: Re: Datagrid Append getting data from previous row Post by: stworthy on May 16, 2013, 12:30:07 AM Try the code below:
Code: var dg = $('#dg'); Title: Re: Datagrid Append getting data from previous row Post by: devnull on May 16, 2013, 12:47:24 AM Thanks, but I needed for this to be done inside the datagrid column definition, this now works:
Code: $.extend($.fn.datagrid.defaults.editors, { Code: editor:{ |