-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update table data #38
Comments
@diclonius How you update a record and reload the table? Could you show some code? |
Hi, thanks for your response. I am using ASP.NET, I use the UPDATE PANEL to update the table. With PHP I use the $ ajax function of jquery to update the data in the table. It tries to add the registers, but it does not work either, the filters take the previous data. |
What do you do exactly in |
I recreate the table when I use $ .ajax. Also when I use the UPDATE PANEL of ASP.NET Webform, the table is recreated. |
This is my Code
In addition to recreating the table, I have tried the following:
|
You need to use the methods available on the datable, e.g.:
|
Thank you very much, I had not found these Syntax in the documentation. Is it also possible to edit and delete? Can you recommend me something to do the data filling of a web service? |
Yes, you can delete and edit row if you have a way to identify rows, e.g., a
And:
You can change the way item are identified by setting the
This is document at the bottom of the page: http://holt59.github.io/datatable |
Thank you very much for your help, I tried to use the Insert, but I could not, can you guide me? Sorry for my ignorance. I have tried the following:
And
|
I think the plugin recognize your array as if you wanted insert multiple records... You can try:
|
It is not effective :(, I notice that the table is recharged, but it does not add the record, I have it this way: function add () |
I would need a more complete example to be able to help you further. Do you notice anything in the JS console? |
This is my code: In the Head
In the Body
|
The problem is the select filter you use I think. Since you specify You need to either:
|
Thank you very much, I will do the tests and then I will comment on how it came out. |
Hello again. I have tried the routine of adding in PHP and it works perfectly, I do not understand why ASP.NET WEBFORM does not work. Now I have another question. How can I update a record in the table? I have. $ ('# TableBstt'). Datatable ('update', itemId, newItem); But it is not clear to me whether the itemId is the selector of the column or the index of it, that is, how I can identify the exact cell I want to update. |
@diclonius There are examples at the end of this page: http://holt59.github.io/datatable (sorry, anchors do not work... ). Basically, you need to specify when constructing the table how you want to identify the elements, e.g.: $('#TableBstt').datatable({
identify: 0 // Identify elements according to the first (0th) column.
}); If your elements are objects, you can specify a key instead (e.g., function (id, element) {
return /* true if id match element */;
} Then you simply do: $ ('#TableBstt').datatable ('update', 7, newElement); ...to update the element whose first column value is 7. |
Also note that you can partially update element this way, e.g.: $ ('# TableBstt'). datatable ('update', 7, {
1: 'FOO'
}); ...will only update the 2nd column with You cannot update the ID of an element this way, e.g.: $ ('# TableBstt'). datatable ('update', 7, {
0: 6
}); ...will do nothing if |
Thank you, perform tests and I will be feeding back. |
Hello, the plugin works perfect.
But I'm having a problem. When I update a record in and reload my table, the filter data, reordering is not updated. There is some function or method that you can use to update this data.
The text was updated successfully, but these errors were encountered: