Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82436

Have two inline editable columns display as one inline editable column in the table

$
0
0

I don't have test code to attach as I haven't attempted to get this working because I don't know how (or if it's possible).

I need a single column called Result which is an editable field the user can enter a result for a test into (like in an exam). This column in data tables will represent two columns in the sql database (one is numeric, one is a Boolean). Depending on the result type that's expected for the test (row) the editable field will represent either the numeric result or the Boolean result. To the user this will appear as a single column though.

I have this working just fine as two separate columns, but it both looks confusing and is also adding an extra column on an already crowded table.

Is there anyway to achieve this? I've googled related questions and checked the examples and can't see how.

I'm currently disabling one of the columns using the below code. I want to do something similar but instead of disabling I want to swap out the editable TD per row, if that makes sense.

editor.dependent('resultTypeId', function ( val, data, callback ) {
    if (val == '1') {
        editor.enable( ['truthyResult'] );
        editor.disable( ['numericResult'] );
    } else {
        editor.disable( ['truthyResult'] );
        editor.enable( ['numericResult'] );
    }
  })

Viewing all articles
Browse latest Browse all 82436

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>