Add checkbox in the table on the client-side
Add checkbox in the table on the client-side
Hi Allan,
I am using this amazing webcomponent, and I already did a donation and I want to do that every month.. Thank you very much for this component.
Brother, I'm having a problem when I try to use the datatable on the following way. I want to render a checkbox in each row of the datatable... I know how to do that, but not in my way. For example... the datatable receives from the server the data... at total, are 6 columns, but, my datatable has 7 columns... the last one column (7) is specific to put the checkbox.
my table:
"[code]
NFS-e
Data de Emiss
I am using this amazing webcomponent, and I already did a donation and I want to do that every month.. Thank you very much for this component.
Brother, I'm having a problem when I try to use the datatable on the following way. I want to render a checkbox in each row of the datatable... I know how to do that, but not in my way. For example... the datatable receives from the server the data... at total, are 6 columns, but, my datatable has 7 columns... the last one column (7) is specific to put the checkbox.
my table:
"[code]
NFS-e
Data de Emiss
This discussion has been closed.
Replies
Don't know what your server code looks like but just output the with it.
At least that is how I do it.
I could do that.. for example.. in my server side I have:
[code]
foreach (DataRow item in dt.Rows)
{
alNotas.Add(new string[7] {item["NUNUMERO"].ToString(),
item["DTCOMPETENCIA"].ToString(),
item["STTOM_NOME"].ToString(),
item["VLTOTALLIQUIDO"].ToString(),
item["VLTOTALISS"].ToString(),
item["VLDEDUCOES"].ToString(),
"Nothing"
});
}
return new JsonResult { Data = new { aaData = alNotas } };
[/code]
well.. where is written "nothing", it shouldn't exist..I should return just 6 fields, not 7, so, in the the 7th column would be created dinamically (with the checkbox).
I could do to return insted of "nothing"... return "", however, I wouldn't like to return a html element from my business layer.
If you realy don't want to mix business layer with presentation - just return "" or "0"/"1" (If you want to know if the checkbox should be on from the get go) in the seventh col, and in client side handle that - just like you did.
It is not realy mixing business layer with presentation because the checbox is part of your BL - I guess it is not there only for viewing - it is in some way part of your BL.
big-deal