Enabling column editing
Enabling column editing
I know there are a number of ways to use datatables with column editing enabled. I was doing some reading and wanted to check-in to see if I’m heading down the right path for my situation.
(still reading through the forums and blogs, lots of really good info here)
1.) Tools that I’m using
Microsoft Visual Studio 2013
.NET Framework 4.5
ASP.NET MVC 4 Web App
MySQL
2.) What I’ve got so far
I have datatables working now and it’s a great toolset to have for tables. I query a mysql database and display my results using datatables as in the code snippet below:
//initialize html table and bind to datatable
var table = $('#results-grid’).DataTable();
//clean up table for the new query results
table
.clear()
//.draw();
$.ajax({
url: gbDataURL,
data: JSON.stringify(model),
type: 'POST',
async: true,
contentType: 'application/json; charset=utf-8',
success: function (data) {
//continue code if successful
//add body
$.each(data.results, function (i) {
table.row.add([
'<tr>'+
'<td>' + data.results[i].id + '</td>',
'<td>' + data.results[i].priority + '</td>',
'<td>' + data.results[i].status + '</td>',
'<td>' + data.results[i].build + '</td>',
'<td>' + data.results[i].Summary + '</td>'+
'</tr>'
]);
});
table.draw();
},
3.) What I’m looking to add, basic CRUD is what I’m looking to implement that writes back to my DB.
I’m looking to add edit functionality in one column. Something that looks and feels like a HTML input field. I can see my values, update them and save them to my db either on-update or via submit button. I’m dealing with less that ~200rows of data most of the time.
4.) My quesstions
-I’d like to stay within the datatables api is this possible?
-DataTables Editor, do I need this? Or will other inline editing work.
-Do I need PHP? Note: I’m still new to this
I don’t want to add or remove records, just enable updating on one column.
Some good reading...
Replies
bump
I finally got a chance to do more reading this week. I've decided to give DataTables Editor a shot for my needs.
-I download the .Net Version
-Created a new MySQL DB and Tables w/data (using the sql script provided)
-Opened the WebAPI Examples project and modified the Settings settings with
DbConnection Value = mServer=dev.com;Port=3307;Database=JohnDV_db;Uid=root;Pwd=xxxxx;
DbType Value = mysql
After I Here's the error I've been fighting for a few hours.....seems like a configuration issue but I'm not sure
Server Error in '/' Application.
Unable to find the requested .Net Framework Data Provider. It may not be installed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
Source Error:
Line 43: {
Line 44: _DbType = dbType;
Line 45: DbProviderFactory provider = DbProviderFactories.GetFactory(Adapter());
Line 46: //DbProviderFactory provider = DbProviderFactories.GetFactory("MySql.Data.MySqlClient");
Line 47:
Source File: c:\Data\mantix\Assets\Editor-NET-1.4.0\DataTables\Database.cs Line: 45
Stack Trace:
[ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.]
System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +1442135
DataTables.Database..ctor(String dbType, String str) in c:\Data\mantix\Assets\Editor-NET-1.4.0\DataTables\Database.cs:45
WebApiExamples.WebApiApplication.Application_Start() in c:\Data\mantix\Assets\Editor-NET-1.4.0\WebApiExamples\Global.asax.cs:20
[HttpException (0x80004005): Unable to find the requested .Net Framework Data Provider. It may not be installed.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9936761
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
[HttpException (0x80004005): Unable to find the requested .Net Framework Data Provider. It may not be installed.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9915300
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
Ok, I re installed the mysql .net data connector and things appear to be working in the editor examples.
I'll look around a bit then try to get editor up and working in my project