Still cannot get drop down list in DataTable to work

Still cannot get drop down list in DataTable to work

xesionprincexesionprince Posts: 12Questions: 0Answers: 0
edited September 2013 in DataTables 1.9
I have the following code:

$('select').change(function (e) {

if (e.srcElement.id == 'clsTitlsForTotUnassign') { // Ignore the drop down on the Classifications page.
return false;
}
var classificationChoice = e.srcElement.value;
if (classificationChoice == 'Not Assigned') {
return false;
}

$('#selectedAssignment').val(classificationChoice);
$('#selectedAssignment').keyup(resizeInput).each(resizeInput); $('#submitRow').show();
$('#submitRow').show();
$('#delSubmitRow').show();
$('#reasonTextarea').focus();
});

but it only works on rows in the datatable that are visible when the page loads.
If I page, sort, or use prev next buttons the event is ignored.

Please, someone help, I've tried on Stackoverflow too, with no response!

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    See the top FAQ: http://datatables.net/faqs#events .

    In future please link to a test case as noted in the forum rules.

    Allan
  • xesionprincexesionprince Posts: 12Questions: 0Answers: 0
    edited September 2013
    Hi, what is a test case??
    I've already been to that link and it is no help :(
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    A test case is simply a link to the page where you are seeing the problem so we can also see it and offer some help, rather than just guessing :-)

    Allan
  • xesionprincexesionprince Posts: 12Questions: 0Answers: 0
    Well I am running my app on http://localhost at work using the built in ASP.net development server within Visual Studio, so how am supposed to link to that?
  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    http://www.datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read
  • xesionprincexesionprince Posts: 12Questions: 0Answers: 0
    I can't use either of those options because my data table is built in an MVC 4 asp.net view and the table uses server side code using the Razor syntax.

    Also, 1151 rows are displayed in the datatable.

    Anyway, I've sorted this now and it was so simple!
    Instead of the nightmare of trying to learn the jEditable api, I simply did this:


    @For Each row In _assignments
    @

    @row.ProductKey
      
    @row.ProductName


    @row.InsuranceGroupKey
      
    @row.GroupName


    @If row.ClassificationChoice Is Nothing Then
    @
    Else
    @
    End If


    Next


    I can now grab a table row cell content (even after scrolling and paging) without resorting to any editable plug in whatsoever !! ;)
This discussion has been closed.