How To send Submit if Cell Checkbox checked

How To send Submit if Cell Checkbox checked

SunilgoelSunilgoel Posts: 48Questions: 19Answers: 0

Hi ,

I have cell type "checkbox" , if Checked then Value will be "Y" else "N" .

If checkbox select or unselect , how to submit and set value Y or N in tables.

Regards.
Sunil

Answers

  • PaulusPaulus Posts: 69Questions: 17Answers: 5

    Do you have license to the Editor or you are only using the DataTable?

  • SunilgoelSunilgoel Posts: 48Questions: 19Answers: 0

    Hi
    Yes i have Editor License.

    Regards.
    Sunil

  • allanallan Posts: 61,740Questions: 1Answers: 10,111 Site admin

    Hi Sunil,

    You should be able to use the options parameter for the checkbox field type to set the values and labels that you want to use.

    There is an example of that available here.

    Allan

  • SunilgoelSunilgoel Posts: 48Questions: 19Answers: 0

    Hi Allan,
    When i Checked checkbox , does not send data to server where as if i changed anything changed value in cell then works well. Please suggest.

    Regards.
    Sunil

  • PaulusPaulus Posts: 69Questions: 17Answers: 5

    Hello Sunil,

    Sorry, I missed the reply. Have you tried this sample

    https://editor.datatables.net/examples/api/checkbox.html

    Make sure you set the options (with the value to 'Y')

    options:   [
          { label: '', value: 1 }
    ]
    

    and this code, which submits the changes

        $('#example').on( 'change', 'input.editor-active', function () {
            editor
                .edit( $(this).closest('tr'), false )
                .set( 'active', $(this).prop( 'checked' ) ? 1 : 0 )
                .submit();
        } );
    
  • SunilgoelSunilgoel Posts: 48Questions: 19Answers: 0

    Hi Paulus,
    work done. Thanks Guys.

    Regards.
    Sunil

This discussion has been closed.