WebSite X5Help Center

35 Ответы - 6 Полезно - 1 Корректно
Axel  
Axel  
User

Hello Hanafi,

from my side, your link does not works. Error : DNS_PROBE_FINISHED_NXDOMAIN

On my example, maybe it could be useful

https://wsx5demo.afsoftware.fr/homebis.php

Axel

Читать больше
Размещено От Axel  
Hanafi Salman
Hanafi Salman
User
Автор

Hi Axel, text searched on https://wsx5demo.afsoftware.fr/homebis.php is for search and highlight text within the page object but not for search within CSV table.. the js code link above was created by KolAsim

Читать больше
Размещено От Hanafi Salman
Axel  
Axel  
User

@Hanafi

Yes the code on my demo if from KolAsim and documented into source code.

so what the subject of your remark ?

it is a solution . And i think it can works into any object on the page. inspect my demo to get the code and test it

if not useful for you, go away

bye 

Axel

Читать больше
Размещено От Axel  
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator
Hanafi Salman
Hi, need help if there is any HTML/JS code for search text on CSV table object?, for button and field search. Link my csv table below: https://smpn1simpangempatkabbanjar.sch.id/datasiswa.html Thanks anyway.

(It > En) ... try my custom code for your CSV table...
... take it blind, and it obviously won't paginate...
... you should get the same result as my simulated PRINT STAMP:

.

ciao

.

Читать больше
Размещено От  ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator

... ... This is the code for you, to insert into the Properties of that page | Expert | Before the closing /HEAD tag:

<script>
/** --cerca nel testoK x WSx5 by KolAsim -- **/
$(document).ready(function () {
const $objectK = $('#table-pluginAppObj_19_11');
/**--fK--**/
const maxAttempts = 10; let attempt = 0; function waitForObjectAndInit() {
if ($objectK.length && $objectK.is(':visible')) { setTimeout(() => { initSearchScript($objectK); }, 1000); } else if (attempt < maxAttempts) { attempt++; setTimeout(waitForObjectAndInit, 1000); } else {} } waitForObjectAndInit(); }); function initSearchScript($objectK) { const styleK = ` <style> .highlight { background-color: yellow; } .active { background-color: orange; border: 1px solid red; } .controls, #toggleSearchControls { position: fixed; top: 10px; z-index: 10000001; } .controls button {cursor: pointer;} .controls { z-index: 10000001; left: 80px; background: white; padding: 2px; border: 1px solid #ccc; display: none; box-shadow: 0 2px 6px rgba(0,0,0,0.1); } #toggleSearchControls { left: 10px; background: blue; color: white; border: none; padding: 4px 10px; cursor: pointer; border-radius: 4px; } #toggleSearchControls:hover { background: Crimson; } </style>`; $('head').append(styleK); const toggleButton = `<button id="toggleSearchControls" title="Open/Close-Search">&#x1f50d;Search</button>`; $('body').append(toggleButton); const formRicercaK = ` <div class="controls"> <input type="text" id="searchTerm" style = "width:100px" placeholder="Search..." /> <button type="button" id="btnSearch">Search</button> <button type="button" id="btnPrev" title = "Back">◄</button> <button type="button" id="btnNext" title = "Next">►</button> <button type="button" id="btnClear" title = "Delete">&otimes</button> <span id="status"></span> </div>`; $('body').append(formRicercaK); let matches = []; let current = -1; $('#toggleSearchControls').on('click', function () { $('.controls').fadeToggle(150); }); function walkTextNodes(node, callback) { $(node).contents().each(function () { if (this.nodeType === Node.TEXT_NODE) { callback(this); } else if (this.nodeType === Node.ELEMENT_NODE && !['SCRIPT', 'STYLE'].includes(this.tagName)) { walkTextNodes(this, callback); } }); } function doSearch() { clearSearch(); const term = $.trim($('#searchTerm').val()); if (!term) { $('#status').text(''); return; } const regex = new RegExp(term, 'gi'); $objectK.each(function () { walkTextNodes(this, function (textNode) { const text = textNode.nodeValue; const matchesInNode = []; let match; while ((match = regex.exec(text)) !== null) { matchesInNode.push({ index: match.index, length: match[0].length }); } if (matchesInNode.length > 0) { let lastIndex = 0; const $frag = $(document.createDocumentFragment()); for (const m of matchesInNode) { const before = text.substring(lastIndex, m.index); if (before) $frag.append(document.createTextNode(before)); const $span = $('<span>').addClass('highlight').text(text.substr(m.index, m.length)); $frag.append($span[0]); matches.push($span[0]); lastIndex = m.index + m.length; } const after = text.substring(lastIndex); if (after) $frag.append(document.createTextNode(after)); $(textNode).replaceWith($frag); } }); }); if (matches.length > 0) { $('#status').text(`Trovate ${matches.length} occorrenze.`); current = -1; nextMatch(); } else { $('#status').text('No matches found.'); } } function nextMatch() { if (matches.length === 0) return; if (current >= 0) $(matches[current]).removeClass('active'); current = (current + 1) % matches.length; $(matches[current]).addClass('active'); matches[current].scrollIntoView({ behavior: 'smooth', block: 'center' }); $('#status').text(`Result ${current + 1} of ${matches.length}`); } function prevMatch() { if (matches.length === 0) return; if (current >= 0) $(matches[current]).removeClass('active'); current = (current - 1 + matches.length) % matches.length; $(matches[current]).addClass('active'); matches[current].scrollIntoView({ behavior: 'smooth', block: 'center' }); $('#status').text(`Result ${current + 1} di ${matches.length}`); } function clearSearch() { matches.forEach(span => { const $span = $(span); $span.replaceWith(document.createTextNode($span.text())); }); matches = []; current = -1; $('#status').text(''); } $('#btnSearch').on('click', doSearch); $('#btnNext').on('click', nextMatch); $('#btnPrev').on('click', prevMatch); $('#btnClear').on('click', clearSearch); $('#searchTerm').on('keydown', function (e) { if (e.key === 'Enter') doSearch(); }); }
</script>

..............................

.

Читать больше
Размещено От  ‪ KolAsim ‪ ‪
Hanafi Salman
Hanafi Salman
User
Автор

Thanks for the code @KolAsim, I applied that it can search a word where we are in current page only within csv table, but when I click "Next ►", not show directly for result on other page containing the word.

And if I search on the other page, for example, I am on page 1 searching for a word, and the word is on page 30... the results do not immediately display the contents of page 30.

Читать больше
Размещено От Hanafi Salman
Hanafi Salman
Hanafi Salman
User
Автор

@Axel

Thanks but I applied not work on csv table.. work only for text object

Читать больше
Размещено От Hanafi Salman
Hanafi Salman
Hanafi Salman
User
Автор

I am sorry @John I am still confuse for the code, It says set options in index.html, but on websitex5 the code should be placed in Properties of that page | Expert | Before the closing /HEAD tag

I don't understand coding at all and it says in step 4 and 5 run and deploy.. sorry make me confuse

anyway thanks for your information

Читать больше
Размещено От Hanafi Salman
John S.
John S.
User

Create a subfolder and have it to work there - independently of X5.

When you have it to function then in X5 insert an html-object on the page where you want it.

In the html-object you define an iframe, and the content of that iframe is the view.

The only code you need in X5 is the code for the iframe

You can see this functioning here (down the page): https://kosraepower.com/customer-info.html

Читать больше
Размещено От John S.
Hanafi Salman
Hanafi Salman
User
Автор

Owh you mean that I do not use CSV viewer object from X5.. ok I try to learn based on information from you above.. by the way is that free or paid? I see the option 1 from the link  https://kosraepower.com/customer-info.html

Thanks John

Читать больше
Размещено От Hanafi Salman
John S.
John S.
User

It is freewink

And it is better than the X5 viewer - much better. You can use links.

It is not the best on the net, but it is rather easy to handle.

There is also the very-easy-to-handle Luxviewer: https://www.luxsoft.eu/?luxview

Maybe this is the best solution for you. Easy to set up. You place it in an iframe. That's simple.

It is free. And it is supported. Maybe you should use that. I use it myself.

Читать больше
Размещено От John S.
Axel  
Axel  
User

@John,

CSV viewer object should be easier.... wink

Читать больше
Размещено От Axel  
Hanafi Salman
Hanafi Salman
User
Автор

Sounds interesting.. perhaps I have to learn stronger.. if you don't mind helping me if there are some things that I don't understand.. May I ask for your email address?, oh yeah, this is mine: *** 

Thanks so much John

Читать больше
Размещено От Hanafi Salman
Hanafi Salman
Hanafi Salman
User
Автор

@Axel.. it's true, but it's not equipped with a Search feature. For those who do not understand script and coding, it's very useful

Читать больше
Размещено От Hanafi Salman
John S.
John S.
User

Bottom of this page: https://bramminginfo.dk/

The answer to the question is kat

Читать больше
Размещено От John S.
Hanafi Salman
Hanafi Salman
User
Автор

OK

Читать больше
Размещено От Hanafi Salman
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator
Hanafi Salman
Thanks for the code @KolAsim, I applied that it can search a word where we are in current page only within csv table, but when I click "Next ►", not show directly for result on other page containing the word. And if I search on the other page, for example, I am on page 1 searching for a word, and the word is on page 30... the results do not immediately display the contents of page 30.

...my code is my own invention, originally created years ago, obviously for other purposes. It can be applied with a single click, and it works, but I warned you about the limitation before:

... take it blind, and it obviously won't paginate ...cool...

...!... however, with a small modification, always based on my other exclusive inventions, you could get something similar to these simulations:

...if you're interested in trying it, just one click, ...let me know...
.
bye, ciao

.

Читать больше
Размещено От  ‪ KolAsim ‪ ‪
Axel  
Axel  
User

Hello Hanafi,

Works fine with CSV Viewer object.... Very quick integration with KolAsim's script

@KolAsim,

Yes please send your new custom code about searching a little more sexy. I will implemente it on my demo website too.

Axel

Читать больше
Размещено От Axel  
Hanafi Salman
Hanafi Salman
User
Автор

Yes @KolAsim, I am so interested..

Thanks lots

Читать больше
Размещено От Hanafi Salman
Hanafi Salman
Hanafi Salman
User
Автор

I am sorry, just realized that it obviously won't paginate.. 

Читать больше
Размещено От Hanafi Salman
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator
Axel  
... ... ...  @KolAsim, Yes please send your new custom code about searching a little more sexy. I will implemente it on my demo website too. Axel

... OK ... the code follows later in the Post for Hanafi Salman, ... you need to customize the initial variable in objectK and the text in textK...
.
HI, ciao

.

Читать больше
Размещено От  ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator
Hanafi Salman
Yes @KolAsim, I am so interested.. Thanks lots

... OK... you can try this code of mine right now in a second with a copy/paste. ...HI, ciao

<script>
/** -- ricerca esclusiva in tabella CSV x WSx5 by KolAsim -- **/
$(document).ready(function () {
const objectK = "#pluginAppObj_19_11";
const textK = "No results found for: ";
/**--fK--**/
const divK = ` <div style="position:absolute;top:-32px;width:390px;z-index:10000000; padding:10px;"> <input type="text" id="searchInputK" placeholder="Search ... .. ." style= "width:100px" title = "Search the table..."> <button id="searchBtnK" title="search"> &#128269; </button> <button id="resetBtnK" title="reset"> &#8617; </button> <div id="searchMessageK" style="display:none; color: red; font-weight: bold; margin-top: -23px;position:absolute;left:190px;background-color:yellow"></div> </div> `; let tentativiK = 0; const maxTentativiK = 10; const intervalloK = setInterval(function () { const $tableBodyK = $(objectK + " .footable tbody"); if ($tableBodyK.length > 0 && $tableBodyK.is(":visible")) { clearInterval(intervalloK); $(objectK).prepend(divK); const $searchInputK = $("#searchInputK"); const $searchBtnK = $("#searchBtnK"); const $resetBtnK = $("#resetBtnK"); const $msgK = $("#searchMessageK"); const $rowsK = $tableBodyK.find("tr"); function resetTable() { $searchInputK.val(""); $msgK.hide(); location.reload(); } $searchBtnK.on("click", function () { const filtroK = $searchInputK.val().toLowerCase().trim(); let risultatiTrovatiK = 0; $rowsK.each(function () { const $rowK = $(this); let matchK = false; $rowK.find("td").each(function () { const cellTextK = $(this).text().toLowerCase(); if (cellTextK.includes(filtroK)) { matchK = true; return false; } }); $rowK.toggle(matchK); if (matchK) risultatiTrovatiK++; }); if (risultatiTrovatiK === 0) { const textK2 = `${textK} "${filtroK}"`; $msgK.text(textK2).fadeIn(); setTimeout(() => { $msgK.fadeOut(); resetTable(); }, 2000); } else { $msgK.hide(); } }); $resetBtnK.on("click", resetTable); } else { tentativiK++; if (tentativiK >= maxTentativiK) { clearInterval(intervalloK); setTimeout(() => { }, 1000); } } }, 1000); });
</script>

.

.

Читать больше
Размещено От  ‪ KolAsim ‪ ‪
Hanafi Salman
Hanafi Salman
User
Автор

Thank you very much KolAsim.. I'm still out of town, now on my way home.. I'll try it in the next 3 hours.

Thanks

Читать больше
Размещено От Hanafi Salman
Hanafi Salman
Hanafi Salman
User
Автор

It works so well @KolAsim.. Perfect.. Thanks so much for your help

Читать больше
Размещено От Hanafi Salman
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator

... I saw ... it works, ... OK ... bye ... ciao ....

.

Читать больше
Размещено От  ‪ KolAsim ‪ ‪
Hanafi Salman
Hanafi Salman
User
Автор

I applied it for desktop view and it works very well and so perfect, but there is a little problem on smartphone view, I run chrome browser from my smartphone, I have to click twice the search button (I change with "Mencari") to find the word I am looking for.

Or perhaps it comes from the browser, chrome for mobile..

Thanks KolAsim..

Читать больше
Размещено От Hanafi Salman
Hanafi Salman
Hanafi Salman
User
Автор

And can I customize the search box corner.. I can't find the px of that.. sorry to waste your time..

Читать больше
Размещено От Hanafi Salman
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator
Hanafi Salman
... ... ... Or perhaps it comes from the browser, chrome for mobile.. ... ... ...

...sorry, ...I tried it on my smartphone without any problems. It works fine, regular...
Hi, ciao

.

Читать больше
Размещено От  ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator
Hanafi Salman
And can I customize the search box corner.. I can't find the px of that.. sorry to waste your time..

... I'm sorry, ...I don't understand, ...perhaps attach a STAMP explaining what it is and what you're trying to achieve...

ciao

.

Читать больше
Размещено От  ‪ KolAsim ‪ ‪
Hanafi Salman
Hanafi Salman
User
Автор

I am sorry, the issue from my chrome browser on my smartphone.. when I install firefox then run the script, works so well.. very nice.. thanks so much KolAsim..

I mean for box corner.. as in the X5, there is rounded corner feature for Border (value is 1 when no round set), I tried to find on the script to customize for search box border when the result no round border...

Читать больше
Размещено От Hanafi Salman
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator

... OK ... in the style of this string:
<input type="text" id="searchInputK" placeholder="Cari data..." style= "width:150px" title = "Search the table...">
... add this attribute    border-radius:0;
... as you see here highlighted in bold:
<input type="text" id="searchInputK" placeholder="Cari data..." style= "border-radius:0;width:150px" title = "Search the table..."> 

.

ciao

.

Читать больше
Размещено От  ‪ KolAsim ‪ ‪
Hanafi Salman
Hanafi Salman
User
Автор

It works so perfect, thanks for your help..

Thank you very much KolAsim..

Читать больше
Размещено От Hanafi Salman