create a "read more" link in a field in table view
Hi everyone, does anyone have any idea how to create the typical "read more" function by a customization in the hook file or in a tablemane_tv.js file, by clicking on which you can expand a text?
Thank you!!!
Fabiano G.
create a "read more" link in a field in table view
Re: create a "read more" link in a field in table view
Hi,
can you make a sample "screenshot" of what you try to acheive? Do you want to add additional text and buttons for the read more?
can you make a sample "screenshot" of what you try to acheive? Do you want to add additional text and buttons for the read more?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: create a "read more" link in a field in table view
Hi,
you can try this in your TABLENAME-dv.js:
Hope this helps,
Regards,
Jan
you can try this in your TABLENAME-dv.js:
Code: Select all
// paste this in your TABLENAME-tv.js
$j(function () {
// change tablename, columnname and length of text
var tbl = "wirtschaftseinheit_hinweise";
var col = "text";
var limit = 100;
// do not change below
var ix = 0, i = $j("<i/>").addClass("glyphicon glyphicon-plus");
$j("td." + tbl + "-" + col).each(function () {
var td = $j(this), text = td.text();
if (text.length > limit) {
var summary = text.substr(0, limit);
var all = $j("<span/>").attr("id", "collapse-" + (++ix)).append(text.substr(limit)).appendTo(td).css("display", "none");
var a = $j("<button/>").attr("type", "button").addClass("more").addClass("btn btn-xs btn-default").addClass("nav-toggle").attr("href", "#collapse-" + ix).append(i.clone());
td.html('').append(summary).append(" ").append(a).append(all);
a.on("click", function () {
var btn = $j(this), href = btn.attr("href"), text = $j(href).text(), e = $j(href);
td.append(text); e.remove(); btn.remove();
});
}
});
});
Regards,
Jan
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: create a "read more" link in a field in table view
Perfect. I will try your solution soon. That's exactly what I was looking for.
One question: is there a way to make another button appear to contract the text again after expanding it?
Thank you!
One question: is there a way to make another button appear to contract the text again after expanding it?
Thank you!
Re: create a "read more" link in a field in table view
Ok! It work great!!!
Thank you!
Any suggestion about my second question:
is there a way to make another button appear to contract the text again after expanding it?
Thank you!
Thank you!
Any suggestion about my second question:
is there a way to make another button appear to contract the text again after expanding it?
Thank you!