post input checks into collection

post input checks into collection

fpachonfpachon Posts: 4Questions: 0Answers: 0
edited July 2009 in General
Hi,
I would firstly like to express my admiration for the fantastic job done.

I am developing an application with ASP.NET MVC, jQuery and jquery.dataTables.1.5.7-1.3.2.min.js

I have many views in which I apply $("#mytable").dataTable() to my HTML tables without problems. However I have a problem in a view. I want to post the values of a group of inputs (checks box) to server. The server side receive a collection of fully-populated. NET objects as an action method parameter. Normally, all the incoming data will be automatically parsed into the collection. But in this view, only the first input is parsed and not the entire collection.

To consider:
** In this view I have one other form that call for a different action.
** Similar scenarios go correctly in other views, but with only one form.
** If I set "iDisplayLength": -1 , all all the incoming data is automatically
parsed into the collection
** Or if I erase $("#mytable").dataTable() from javaScript all is right: all the incoming data is automatically
parsed into the collection

Cliente Side (Simplified)

[code]





<!--check para seleccionar-->



























[/code]
Server Side:
lista is a collection of IdSocioASeleccionar object

[code]
public ActionResult GenerarRecibos(List lista)
{

}

public class IdSocioASeleccionar
{
public int Id { get; set; }
public bool seleccionado { get; set; }
}
[/code]


thanks in advance

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi fpachon,

    The problem here is that not all of the information you want to submit is actually in the DOM when you press the submit button. The reason for this is that DataTables will hide the rows which are not in the current page (hence why it works when you set the display length to -1, since all rows are shown on the page!).

    This issue is covered in a number of other threads in the forums, and this might be one of the more interesting ones (as it includes a code clip for getting around the issue): http://datatables.net/forums/comments.php?DiscussionID=99&page=1#Item_16

    Regards,
    Allan
  • fpachonfpachon Posts: 4Questions: 0Answers: 0
    Thanks for your reply Allan,

    After a month of vacation, I have taken up the task and it works perfect.
    You've done an incredible job with DataTables!

    thanks
This discussion has been closed.