Laravel - Yajra DataTable build with Infyom package does not show data - javascript

I already use Laravel 8 with Yajra DataTable et wanted to test Infyom Laravel-Generator that seems to be a great package.
I created my first test app and generated a Yajra DataTable.
I see the datatable page, I was able to create a first record, the table in the database is updated, but the page shows always no record even if I refresh it.
And there is no Search input on the page.
I see nothing in the Laravel logs.
When I open my browser (firefox) in dev mode, I see no XHR request that seems to be abnormal since I see such a request on a website with datatable build without Infyom package.
Having a look in the source of the html page, no datable script is present!
So the pb should come from the genaration script, I used this cde :
php artisan infyom:scaffold Es5 --fromTable --tableName=es5 --datatables=true
I'll appreciate any help to debug/explai this.
Thanks in advance.
PS : Let me know if you want me to share some code, but now I don't know which part should be useful.

this could happen if the number of columns you defined inside your HTML table is not equal to the number of fields you are trying to fill inside your javascript code.

How did you implement it?
Did you use service implementation? I suggest to handle it in this way

I forgot to publish datatable add_on html & buttons
and found the solution here
https://github.com/InfyOmLabs/laravel-generator/issues/84

If you are using the adminlte-generator scaffold, there is an issue with the javascript is not being imported. Here is the solution:
https://github.com/InfyOmLabs/adminlte-generator/issues/87
Find #yield('third_party_scripts') in views/layouts/app and change it to #stack('third_party_scripts').

I had put my 2 days on that but the answer was so simple. make sure the yajra/datatable JS script is loading while you trying to render table
Simply change in your layout/app.blade.php
from
#yield('third_party_scripts')
to
#stack('third_party_scripts')

Related

Getting data from Dark Sky API using handlebars, issue with routing

I have an issue regarding the script which helps me get the data from Dark Sky API.
I am developing the app in node.js using handlebars.
I am trying to get just some specific data from the forecast script, send it to app.js script which does the page routing and then to add it to forecast.hbs page.
Unfortunately, I am really stuck on this.
I have attached the photo with the code.
What I want to do is to get just some specific weather data, so, later on, I can use them one by one in the HTML code.
I have somehow to add them in the callback(right side), then in the middle, where the forecast routing is, then I think I need to replace forecastData with something else like..more variables and add those in the rendering part?
For example, I would like to take the icon variable, which contains the code that I need to add in the hbs page.
I want to do some binding by replacing Skycons.RAIN with Skycons.{{icon}}, where the icon should be in the middle file, like forecast: forecastData.
If I'm using {{forecast}}, I can show all the data that is on the right side, more exactly the variable weatherDetails, which contains the other variables.
How can I take advantage of binding and use it for the icon, for example?
Can somebody give advice, please?
I am really confused...
Kind regards, Gabriel
Why don't add an additional parameter to the callback function and then add it to the handlebars data object? Then you should have access to it in the template.
Btw are you using nodemon with docker? I'm also stuck with a problem, where nodemon isn't updating the container when the files are changed.

Login Required when using AdminDirectory.users.Get in javascript

I am writing an application to list or update users using Javascript. I have enabled the relevant API's in dev console. This all works ok if I use AdminDirectory.Users.list, however when I try to get a single user via AdminDirectory.Users.get and pass the google ID as the key, I get Login Required.
I have tried to add option .viewType = "domain_public" but to no avail.
For now, Im going to re-write the local function that uses .get to get the user via list, but would like to know if anyone else has this problem or know how to fix it.
I ran into the same issue when I tried to write a custom function to retrieve the users in our directory. After reading Paul's comment, I checked and found that custom functions operate with same minimal permissions, so I also added a custom menu to load the users.
At risk of giving advice without testing it myself: for triggers, you'll need to use an event with an authMode value of FULL.
See the Google Apps Script Event Objects guide.

How to let 2 html pages communicate

i'm new to web tecnologies, and i'm trying to make some stuff work. I have 2 similar html pages, with the same table on them.
I have to make sure that every data inserted in the first table (editable) is replicated in the same cell of the second table (of the other HTML page).
HTML code I used is really simple, I've added some style with CSS and 3 functions with JS (add, delete and modify row). I have to replicate these changes to rows too.
I'm a bit confused, I think I have to manage this thing with a server application, maybe in php, but i don't know how to start.
I've searched this site, but I didnt find anything useful, for now.
How can I approach this problem? I want to learn these things, I am not asking you for having working code and easily solve the problem...
Thanks to everybody in advance.
You need to store the data somewhere (database, local storage, cookie, file, etc.), and read it when page loads.
The most common way is to store the data in database.
When your page loads, get the data from the database and build the table.
This is a good place you can start learning how to work with MySql database: http://www.w3schools.com/php/php_mysql_intro.asp
Angular JS library will be a simple solution to your problem.

Bind dynamic JSON data to Knockout view model impossible

Ok, I've been wondering what I'm doing wrong with a Knockout web app I'm trying to put together.
Here is the code excluding the AJAX service with my MVC PHP interface.
my.js = namespace declaration that I use for my app
data.js = contains static data which works to load the data into the view (leftPanel.php)
appViewModel.js = call the functions that loads the data from PHP server and declare the view model.
So, basically, here is the issue:
I've an AJAX Service that works and get the data as show in accounts_JSON.txt and currencies_JSON.txt. The JSON is well formatted and in the text files, I've only added returns to make it easy to read.
In appViewModel.js, the "getCurrencies" and "getAccounts" methods are called and work properly: iterate through the JSON data and put it in the specified array.
Then, at the end of appViewModel.js, I log in the Chrome console each step because I can't find out why "my.app.data.currencies" and "my.app.data.accounts" are logged as empty when they are not (screenshot_chrome_console.png).
Those arrays are populated before the ko.applyBiddings so if I were to use "my.app.data.currencies" and "my.app.data.accounts" to populate the view, it should work but it doesn't. Only the static data "my.app.leftPanel.currencies.list" and "my.app.leftPanel.accounts.list" works.
What am I missing? I really can't see!
Thanks a lot for your help :)
Well, I've solved my issue :) Thanks to this post (from Irakli Nadareishvili).
My problem was definitely the loading method of the data retrieved via AJAX. Using Underscore to load the currencies and the accounts first and when, and only when all is loaded, filteredAccounts is loaded since I need the full list of accounts.
Here is the final and cleaned-up code in case anyone is interested or stumble on the same problem.
Happy coding to all!

Can't use perl WWW::Mechanize to tick checkboxes

I am making a webscraper using perl WWW::Mechanize. My problem is the site that I am scraping is using javascript a bit too much. I am logging in using credentials, Then traversing to custom search using $mech->follow_link(url).
The problem starts from here. I am landing on to a page where I have to select one checkbox and one radiobutton from a javascript enabled dropdownlist. I am stuck at this point.
The part of html is as below. When I am using $mech->tick('cs-MajorIndustryGroup'), I am getting an error
Can't call method "find_input" on an undefined value
WWW::Mechanize doesn't support JavaScript. You could try some of these modules:
Gtk2::WebKit::Mechanize
Win32::IE::Mechanize
WWW::Mechanize::Firefox
WWW::Scripter
WWW::Selenium.
For more information see WWW::Mechanize::FAQ.

Categories