Skip to content

Tag: javascript

How to get a node by index in ag-grid?

AgGrid expects node(s) to be passed in to lot of it’s data functions. How do you get a node by index? Look at the snip below: I can pass the node parameter to refreshRows() function since I’m getting it through forEachNode(). How do you get a node by index without iterating through forEachNode() ?…

chain promises in javascript

I’ve created many promises like that, in order to create object in my database. At the end, I want call all my promises in the order I want. (because somes object depend of other, so I need to keep that order) So I expect to see : Unfortunately, this messages are shuffled and I don’t understand wh…

How to use an if-else condition in a SAPUI5 XML-View?

How can I implement an if-else condition in a XML-View in SAPUI5 that uses a flag (condition) from a JSONModel? So far I have a Controller: and a View: Edit: Is there a better way to do it than by implementing an overkill-feeling XML-Preprocessor? Answer OpenUI5 supports Preprocessing Instructions and Express…

JavaScript – examples of reduce() function

I’m looking at this example of use of reduce() function. Could you give show me some other examples of using reduce() – I’m not sure I fully follow how it works. Thank you Answer What reduces does is take an initialValue, a function with 2 essential parameters (can take more) and a list of v…

Express.Static not working for subdirectory

Express.static is working great for any view in root directory, but it breaks when I add a subdirectory. Works: Doesn’t Work: I’m guessing __dirname is changed to whatever directory the get request is made from, but I just want to use the root (/public) directory for all static requests. Answer Us…

Counting Characters Inside a Paragraph

How do you count how many characters are in a paragraph tag with jQuery/Javascript? For example in this sample it would be 3. Are you able to select the characters with .length() somehow? Answer This is what you want

How to use XHR API in Node.js?

This is a follow-up to my previous question Suppose I’ve some javascript code, which runs fine on client (in a browser). This code makes a lot of XHR calls using the browser API. Now I would like to run this code in node.js. Does node.js provide the XHR API as in browser ? Answer Natively Node.js does n…