The code I showed above is how to initialize a basic datatables. I have done this many times and it was working fine. It is not working inside the aspnetzero solution.
Please read my recent posts on this thread. The validation issue is happening across all variations of the aspnetzero templates. I feel like I am just talking to myself on this thread lately. I'm not really getting any support!
I <span style="color:#FF0000">solved </span>my datatables action column issue. It looks like there is bug in the JS code in script <span style="color:#FF0000">datatables.record-actions.js</span>. Any time you only have one action on the action dropdown it wont render the action column. I fixed it by updating this line of code: <span style="color:#FF0000">if (field.items && field.items.length > 0)</span>
var _createRowAction = function (record, field, tableInstance) {
//20170808 - Fixed IF to check for GT 0, instead of 1
if (field.items && field.items.length > 0)
return _createButtonDropdown(record, field, tableInstance);
} else if (field.element) {
var $singleActionButton = _createSingleButton(record, field);
if ($singleActionButton != "") {
return $singleActionButton.clone(true);
}
}
return "";
}
One other related issue, the basic datatable call, shown below, is not working. I end up with a empty table with "loading" displayed.
$('#tblNotes').DataTable();
How do I initialize a basic datatable?
Also, prior to the V4.X upgrade I was using Editable DataTables. I copied the code/examples directly from Metronic source files. They were all working perfectly. Now in the ASPNETZERO V4.X versions, they are not working. Is there some custom code implemented for Datatables by ASPNETZERO solution?
Ok the validation issue happened again today in my .NET Core MVC solution.
Chrome console showing validation error: <a class="postlink" href="https://drive.google.com/file/d/0B5HAoiVVXzY7Z0JTSjV6MW1YVFU/view?usp=sharing">https://drive.google.com/file/d/0B5HAoi ... sp=sharing</a>
Chrome console showing app service posted values: <a class="postlink" href="https://drive.google.com/file/d/0B5HAoiVVXzY7Y0tPWjFXT3JKRkE/view?usp=sharing">https://drive.google.com/file/d/0B5HAoi ... sp=sharing</a>
As you can see on that screenshot, the field "CompanyRegNumber" is clearly provided on the form. Yet the validation is still firing and reporting that field with that same generic error message? There has to be some issue here? Please help me find it!
Another strange issue here. This issue happens on and off. If I keep testing the same create method over and over again, one fails immediately try the exact same one again, using all the same values and it works! I feel like I am going crazy here or living in the twilight zone!! :o :D
Aug 8: Here is one more example of the same validation error in my other project, using just the open source ABP template with BSB Admin template. <a class="postlink" href="https://drive.google.com/file/d/0B5HAoiVVXzY7U2QxblhTTGFhMnc/view?usp=sharing">https://drive.google.com/file/d/0B5HAoi ... sp=sharing</a>
<cite>alper: </cite> The rendering is done in this javascript file jquery.jtable.record-actions.js So it must be included in your layout. Can you check it?
Today, I tried working on the .Net Core 1.1 MVC template again. Once again, I am having the same issue with DataTables grids, my action column is NOT displaying at all. It works fine on the pages provided in the template, like roles and tenants grids. But on my custom Index grids, using datatables, my action column is not rendering at all. The code from the script datatables.record-actions.js is not firing on my custom index views.
Do I need to explicitly reference this script in each of my index views?
I debugged the issue little further, by adding break statement in the DataTables.record-actions.js script. On the pages for roles & tenants the script is working and going into the methods to render the actions column and button. But for my custom entities and it never hits the methods to render actions. The user who I am testing with has ALL permissions granted so I have confirmed that part. Example showing the render working for the Roles index view: <a class="postlink" href="https://drive.google.com/file/d/0B5HAoiVVXzY7b29leXR5Mk0zWEE/view?usp=sharing">https://drive.google.com/file/d/0B5HAoi ... sp=sharing</a>
For my custom index views that code never gets executed.
My code was working perfectly before the V4.2 upgrade.
If I cannot use "" for the seed value of dropdowns what can I use? I cannot implement "0" in every dropdown as that created FK violations when, on an optional property, the user does not choose a value. Again, this was all working just fine before upgrade.
Can you at least tell me what has changed in the new version that is breaking my code?
How do I debug the validation code, where is the source code for the ABP validation that happens? At least this way i can see the root cause of the issue.
<cite>ismcagdas: </cite> Hi @exlnt,
If this is ASP.NET CORE, then your usage is not allowed from the beginning. But if it is ASP.NET MVC 5.x, ABP framework started to use validaiton of WebAPI and probably because of that you are getting these errors.
We can offer you a solution according to your version (ASP.NET Core ır MVC 5.x ).
Thanks.
I am running the MVC5.x solution in one project and ASP.Net core in the other solution. So I will need both. :D
I am now running into the same validation error on my other project where I am using the basic open source ABP template. Again my app service is getting all the required values passed into method but the ABP validation keeps throwing validation error message.
I did some further testing. It seems that after the upgrade to V4.2, any app service call where I am passing "" (empty/null) for a property, regardless if it is marked as required or not, the ABP validation error happens. The error message is always the same one as shown below, in both solutions.
"The following errors were detected during validation.↵ - ↵"
I get the same error message in both my projects, the ASPNETZERO solution and the open source ABP template solution.
Is there some breaking change in the V4.2 version?
Here is one specific example.
Here you can see the validation errors that are reported on the chrome console: <a class="postlink" href="https://drive.google.com/open?id=0B5HAoiVVXzY7a1VWNUR1NDhENU0">https://drive.google.com/open?id=0B5HAo ... UR1NDhENU0</a>
Here is the DTO used on that app service, as you can see the properties reported in the validation are NOT required. <a class="postlink" href="https://drive.google.com/open?id=0B5HAoiVVXzY7VWttdXhiUER1V3c">https://drive.google.com/open?id=0B5HAo ... XhiUER1V3c</a>
Why is it throwing validation error here?
One further question/help needed. I am still getting this validation error on some of my modal actions. Is there a way where I can debug the built-in ABP automatic validation that happens? When I debug in VS2017, as you have stated before, due to validation it will not reach the app service method. The log file does not show anything. When I look at Chrome console and look at the parameters passed to my app service, all the values are passed correctly. Yet I keep getting a validation error. How can I track down what exactly is causing this validation error, where is source code for the built-in ABP validation that happens?
@ismcagdas - Thanks very much! Better late than never! :D