Darek L
Forum Replies Created
-
Probably You can use the datatables search. Create link to script with it or something like that.
OK. Thanks.
Tobias, thanks. The
wp_enqueue_script
is more recommended for wordpress, so this is why I want to use it now instead of the<link>
HTML tag. I guess the key is to set the dependencies correctly and allow wordpress do the rest. However, I don’t use thewp_register_script
, onlywp_enqueue_script
. Bad?I hope the handle will not be changing so often and all dependencies will be loaded as they should ??
Tobias, actually I don’t see any other solution except that one above with the handle or just use
<link>
HTML tag just afterwp_footer()
as I had before ;-(Tobias,
Why don’t recommend that? What about
wp_enqueue_script
, is it all bad idea?Instead, use a filter hook like tablepress_all_datatables_commands to append setting, or change the parameters via tablepress_datatables_parameters.
What do You mean by filter hook? However I am not sure if it is possible to do that by changing TablePress settings. First I have to get kkstar ratings directly from db via AJAX and then when table is loaded sort using new values readable for TablePress. This is how it goes shortly… I use
fnSort
with customsType
.DataTables JS library yourself
Not will be loaded twice?
I don’t remember if
px
is working too or%
only. But!important
is important ??
Tobias is busy so I am glad I can help ??richmandan, use this method:
#tablepress-1 .column-6 { width: 14% !important; }
Regards,
DarekForum: Plugins
In reply to: [TablePress - Tables in WordPress made easy] No backup for wp_options needed?Tobias,
the tablepress_options option in the wp_options table holds the connection between table ID and post ID. If you don’t need that, there’s indeed no real need to back that up.
I guess backup this options in case of migration to other db can make mess. In other wordpress and tablepress installation the tablepress tables can have other ids. So better not backup them. It would be easier create empty tables manually first in order to set up the ids options.
I have ready and working button to backup options to file on serwer. Now it’s time to make restore for options and then similar backup and restore buttons for kkstarratings and lots of testing.
Tobias, thanks again for confirmation and help.
Regards,
DarekTobias, However no matter if this is bug or not. It is not good idea to change backup file structure. People with old backup would not be able to restore it after any changes so I am going to close it.
Tobias,
The format is always “name”: value, and the data type of value determines if it is also wrapped in quotation marks, see https://en.wikipedia.org/wiki/JSON
So You should have
"id":1,"author":1
not"id":"1","author":"1"
?? lolAlso the
post_content
in tablewp_posts
islongtext
so it should be in quotes ??Thanks for the
wp_slash()
issue. Now I have to make the same backup and restore buttons for tablepress options ?? But probably not Today I am kinda tired ??Thanks,
DarekTobias,
I guess the json format is
"name":"value"
not"name":value
with no matter if the value isarray
orstring
. You can put arrays as string as well. No matter. I had it like this (with quotes) before but TablePress wasn’t able to read it. So It was very hard to me to reproduce the TablePress structure and especially write the data value correctly to database.However Finally, I get it to work. Now I can backup only tables to file on serwer and also restore only tables from file on serwer. Tablepress not reports errors and reads the restored tables correctly now.
The biggest problem was with writing backslash’es to database
post_content
. As You mentioned the data isarray
, so before write it to database I had to convert it viajson_encode
to getstring
. But the problem was with backslash’es. During writting to db they has been automatically removed e.g. in db wasu2013
not\u2013
. So I had to replace one\
with two\\
viastr_replace
to get it to work. Could You please show me the moment in Your code where You write the data value to db? How it looks?Regards,
DarekI’ll need detailed reproducible steps here
Tobias,
1. backup all tables (You need 3 tables) to json zip file 2. remove all tables via tablepress panel 3. import all tables from backuped json zip file NOTE: Now You should have 3 tables again 4. go to import but this time choose replace and choose 1st table NOTE: All tables will be imported again so You should have 6 tables. There will not be 1st table replacement.
If You import one table and choose replace, it works fine.
Regarding
last_id
: I replaced thefor
loop withforeach
so thelast_id
problem is resolved.Regards,
DarekTobias,
This is in ORIGINAL tablepress json file from official site. No changes there were made. The file was exported via TablePress export option. I changed here only manually data into example to public it here. It is like that:
{"id":"1","name":"example name","description":"example dsc","author":"1","last_modified":"2014-09-17 18:50:34","data":[["example col 1","example col 2","example col 3","example col 4","example\u0142o col 5","example col 6"],["example data 1","<a href=\"http:\/\/www.example.pl\/\">example\u017c example\u0142a<\/a>","<a href=\"http:\/\/www.example.pl\/example.html\">example<\/a>","1","example","example\u0144"]]
The value for
id
,name
,description
,author
,last_modified
has ” but value fordata
don’t has ” quotes. It is not json format.Regards,
DarekTobias, I have it on wordpress 4.0 site with the latest tablepress plugin (original). I am not sure if other versions has it too. I observed it first time yestarday.
Tobias, the same is when You have tables and You choose “update existing” in import menu. The existing ones should be overwritten but they don’t, new has been created.