Is it possible to enter data from datatable without using editor?

Is it possible to enter data from datatable without using editor?

msm_baltazarmsm_baltazar Posts: 59Questions: 22Answers: 0

Hello,
I want to use a datatable in a small personal ASP.NET MVC project I'm working on. I will send a link to my customers. In this link, I will collect an offer for the products I want to buy. When the customer clicks on the link, a list of requests will appear in a datatable. The customer will complete the bidding process by typing the price for each product in the input box and selecting the exchange rate and pressing the save button at the bottom. So it will do a simple bidding process for only 2 columns. Is it possible to do this without using the datatable editor, using only the datatable features? Do you have a small project about it?

Answers

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974

    You can use rows().data() to fetch the table data, when the save button is clicked and send that data to the server using jQuery ajax. You may need to use toArray(). Here is an example showing inputs. There aren't any prebuilt examples showing how to send the data to the server.

    Kevin

  • msm_baltazarmsm_baltazar Posts: 59Questions: 22Answers: 0

    I may have misunderstood. I have no problem sending data to server. My problem is creating an editable datatable. I think this will be done without using the datatable editor, but by creating the table manually with html codes on the server side and sending the ready table to the screen. Normally when using datatable, datatable would get data list from server with ajax query. I'm thinking of creating an editable datatable like this again. Unfortunately, there is no ajax query in the Live Dom Ordering example you sent me with the link.

  • kthorngrenkthorngren Posts: 21,443Questions: 26Answers: 4,974
    edited October 2021

    Unfortunately, there is no ajax query in the Live Dom Ordering example you sent me with the link.

    Nope. I provided that example to simply show that you can use inputs with Datatables. Its up to you to create events for those inputs, assuming you want to do inline editing, to handle the updated data.

    by creating the table manually with html codes on the server side and sending the ready table to the screen.

    You could use columns.render to create the HTML elements. See this example.

    Maybe you want to create a form to edit a clicked row. This example shows how to get the data of a clicked row which can be used in an edit form you create.

    My problem is creating an editable datatable.

    Most of this functionality is outside of Datatables. You will need to create the inputs, either inline or forms, and the events to handle the changes and to send the updates to your server. You will need to create a server script to handle the edit, create and delete requests and respond to the client appropriately so the table can be updated properly. Datatables provides the tools to enhance the table display and APIs to retrieve and update the table data, like cell().data() or row().data(), but the rest of the functionality is in your hands to create. We will gladly help with any Datatables specific questions.

    Kevin

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    It would definitely be worth considering Editor, or CloudTables - all those features are included in those products.

    Colin

Sign In or Register to comment.