react-virtualized Masonry: how to scroll to index programmatically? - scroll

I've tried <Masonry ... scrollToIndex={myIndex} /> and <Masonry ... scrollTop={myIndex}, with no success.
Is there a public method, or some other prop I should use?

Looks like Masonry doesn't support this. In my case, List turned out to be what I needed, based on this.

Related

Xpath, div with multiple classes

I feel really stupid: I just read this question How to get html elements with multiple css classes and the answer was very clear and straightforward but when I try to apply it on this HTML
<div class="header group">
I am completely unable to make it work.
Here are some of the variations I have tried
//*[contains (#class, ’header’) and contains (#class, ‘group’)]
//div[contains (#class, ’header’) and contains (#class, ‘group’)]
//div[contains (#class, ’header’)]
What am I missing here? Should be straightforward, shouldn't it?
Testing in Chrome Canary.
Updates
The invalid typographical apostrophes above happened when I copy-pasted into this form. I was using ' in the actual console.
I was playing around on an archived version of the page at the Wayback Machine (WM) and nothing worked. However, when trying on the live version, everything worked as expected (the problem with the live version was that the final element I was "aiming" at currently is missing but will return later on, therefore I used WM). Any ideas why // seems broken on WM? Even if WM adds a few levels of divs, // should be transparent about that, shouldn't it?
Just use this xpath.
//div[#class='header group']
you should use something like this
<xpath expr="//div[hasclass('header') and hasclass('group')]" position="replace">
<t>
xxxxxx
</t>
</xpath>

How to override strapis "primary button"

I'm a graphic designer who has to customize a project done with strapi - and I am sooo lost. I managed to change backgroundcolors, backgroundimages so far - no problem. BUT: I am totally unable to customize the elements like the primary buttons.
I found lots of class definitions ".primary", changed them - without a result ... in the end I removed them all ... but the primary buttons stills look the same. How? Why?
The only why to get rid of the visual appearance of the primary button, was by removing (e.g. of the login page -> within the index.js under admin/src/containers/AuthPage) "primary" of the buttons declaration.
<Button primary label="users-permissions.Auth.form.button.login" type="submit" />
But that's not what I wanted. I want to customize e.g. the primary buttons. Not getting rid of it.
I searched stackoverflow for strapi customization or ui issues but couldn't find a solution. I found a lot of strategies of overriding bootstrap CSS, e.g.:
How can I override Bootstrap CSS styles?
But strapis SCSS seems to something different I obviously don't understand yet.
If anyone has an idea or did already overrides to e.g. primary button - please let me know.
Thanks in advance, Stef.
You have two ways to override the default style of a button
You can pass a style prop to the component
<Button label="Label" type="button" style={{ background: 'red' }} />
You can pass a custom className prop:
In order to do so, you need to add the class in your 'plugins/users-permissions/admin/src/containers/Auth/styles.scss` file (where the component is going to be used)
.customButton {
background: red;
}
Then in your index.js file
import Button from 'components/Button';
import styles from './styles.scss';
render() {
return (
<Button label="label" className={styles.customButton} />
);
}

Show file upload progress in Essence framework

So I have a simple upload file form and I want to use essence-progress as a loading spinner while the file is being uploaded. I use XMLHttpRequest2 so I can track my progress and I get in real time the percent left.
Can essence-progress display that percentage number?
I'm thinking something like this:
<FileUpload>
<Progress progress={'progress'} type={'circle'} />
</FileUpload>
Thanks in advance!
Looking into the source code of essence-progress I don't think there is a direct way of doing this. However, you could maybe build a new component, something like this:
<FileUpload>
<Progress type={'circle'} />
<Percentage value={'progress'} />
</FileUpload>
as a quick way to solve this issue. And with CSS you position it on top of the progress bar.
I hope this helps. Keep me posted :)

Modify built-in ember.js view

I'm new to ember.js and looking at the built-in views: http://emberjs.com/guides/views/built-in-views/
I understand working with views using a data-template name and editing it from Ember.view.extend, but how do I modify these ember.js built in views? And how do view names work?
For example, in my index.html:
<script type="text/x-handlebars" id="test">
<h3>Title</h3>
<p>{{view Ember.TextField valueBinding='title'}}</p>
<h3>Body</h3>
<p>{{view Ember.TextArea viewName="bodyArea" valueBinding='text'}}</p>
<h2>Output</h2>
{{title}}
{{text}}
</script>
Now how might I set the background color of the textarea with the viewName="bodyArea" in my app.js? In the ember.js guide linked to above they show that you can set a viewName property in handlebars but don't show how you might edit it in javascript....
I think you have three questions here:
How do I set a background color on the text area? {{view Ember.TextArea viewName="bodyArea" valueBinding='text' classNames="my-class-name'}} and then use CSS to style "my-class-name".
How do I modify a view with custom behavior?
App.MyTextArea = Em.TextArea.extend({
didInsertElement: function(){
//do something cool here.
}
});
In template:
{{view App.MyTextArea}}
How do I use view name? I'm not sure that is something that is used a lot, but if you define a container view you could access a child view with this.get('myViewName'). As things are more encapsulated within ember a lot of the old uses for viewName no longer seem relevant. Someone else might be able to chime in on this feature.
As an aside you can also use a new short hand for built in views:
{{textarea value=title}} will do the same as {{view Ember.TextField valueBinding='title'}}

joomla custom component - add rich text support

I am developing a cusom component and I would like it to support rich text fields. Possibly the same way it is done in com_content.
in the form definition I have the following field:
<field
name="description"
type="editor"
label="COM_MYCOMPONENT_DESCRIPTION_LABEL"
description="COM_MYCOMPONENT_DESCRIPTION_DESC"
class="inputbox"
filter="MyComponentHelper::filterText"
buttons="true"
/>
So basically what happens is that the editor appears as it is supposed to but the text is saved without formatting.
The MyComponentHelper::filterText method was added later after investigating com_content and copying the filterText method to my helper, but it did not work either with or without the line. I even tried to use ContentHelper::filterText but without success.
In joomla 1.5, you had to do this in the model (in function that does the saving):
$data['description'] = JRequest::getVar('description', '', 'post', 'string', JREQUEST_ALLOWRAW);
if (!$row->bind($data)) {
...
Don't know if it still exists in Joomla 1.6. Hope it helps.
OK, so this was my bad. As I have followed the tutorial MyComponenetHelper ended up as an abstract class. I made it a normal class and everything works fine.

Resources