Shopify/Liquid related - shopify

I'd like to know how I could possibly rearrange the order of a list in Shopify. Now please do note that I have to use the default methods in Liquid as my boss doesn't let me create my own ones. And I also need to override the default order which is set in the admin panel. So is there a way to override it or how could I do it in Javascript? Thanks in advance, regards.

[SOLUTION] I used the tinysort JQuery plugin (http://tinysort.sjeiti.com/)
$(document).ready(function() {
$('table.tables').tsort({data:'price', order:'asc'});
});
This is if you have tables with the class "tables" and with the attribute data-price. The .ready is so that all DOMs and everything will be loaded before we execute the sorting. Hope someone will find this helpful.

Related

Any disadvantage of using window.document.title in angular 5?

Browser title needs to be updated dynamically and i have used window.document.title in individual component to update the title which is absolutely working fine.
But i can see other solutions outside to use title service and subscribe to router events and then set the title which doesn't seem to be a simple solution for me.
Is there any disadvantage of using window.document.title?
What is the better approach? Thanks in advance.

Implementing custom search in datatables.net with angular 4

I'm trying to implement a simple custom search on a column.
This is well documented at https://datatables.net/examples/plug-ins/range_filtering.html.
However my (so far) only problem is accessing the $.fn.dataTable.ext.search array, to add and later remove my custom search function.
What is the path for this array, when going through angular-datatables?
Thanks in advance for your help.
this.datatableElement.dtInstance.then((dtInstance: DataTables.Api) => {
dtInstance. <-- what goes here?
});
Was solved by the developer at https://github.com/l-lin/angular-datatables/issues/1111
It was because the typings were not complete, when using typescript in angular.
Correct reference is $.fn['dataTable'].ext.search

How to run scripts in Durandal View

I have a Durandal App.
On one of the pages, I need to using some existing javascript which I do not want to modify.
However, if I use something like this in the view.html:
<script>alert("test");</script>
the alert is not triggered.
Normally such code would go into the ViewModel. However, in this case, I want to use a Sound Recorder and there is a number of scripts that make this up and I would like to use them as is.
In other words, I would like view.html to act like a regular html page.
When I modify the router to use *.html, it throws an error.
{ route: 'recorder', moduleId: 'views/recorder.html', nav: true }
Is there a way to resolve this?
Taking the recommendation from the OP and posting my comment as an answer:
According to Rob Eiserberg (the author of Durandal), don't do this. The reason being is that all script tags within the view are stripped. I'm sure this is done as a security precaution. Additionally, you could implement the solution recommended here.

FindRow with text values inside span attributes

I am using Watin to find rows in a jQuery table. However, jQuery sets some of its text in a cell within a span class. Watin does not work in these cases.
WebBrowser.Current.Table("grid").FindRow("Liza", columnNum)
The above code works for:
<td>Liza</td>
but not for:
<td><span>Liza</span></td>
Any clue how I can tweak the Watin code to work with span classes?
You might want to try using the Text property to identify
WebBrowser.Current.Table("grid").FindRowInOwnTableRows(t => t.Text.Trim()== rowidentifier, columnNum);
I had some similar issues, my recommendation is to create a helper class that's available to all your specs and you add helper functions there, such as removeHtml, wait for async request, this kind of thing. a good starting point would be these methods http://www.dotnetperls.com/remove-html-tags
So on your tests you can do something like
// where .NoHTML() is a extension method in your helper class
WebBrowser.Current.Table("grid").FindRow(value.NoHTML(), columnNum)
This might not be the exact answer, but I hope it helps

Joomla question about custom module

I'm very new to Joomla. I have a question about components/modules.
I'm doing the development of a site for a firm and they provided me with custom news releases component that's supposed to show on the home page. From what I've seen, I can call modules to a page with "" based on their position.
Do I do the same sort of thing to get this component to display? Can anyone help me out please. Let me know if I'm not being clear.
EDIT: I figured out that I have to add this as a menu item, but this makes it into it's own page. I want this just as a module on the right of the home page. What do I need to do to achieve this?
Thank you
if this is a component than you won't be able to display it in a module position. You will have to write a new module to do that or use some modules which wrap around other types of content. See here, maybe this plugin will fit.
If this is a component you can also use the Component Loader extension to load the component output in a module position.
http://extensions.joomla.org/extensions/core-enhancements/embed-a-include/10721