get date using Angular-UI Bootstrap Datepicker inside Modal opened from Grid cell - datepicker

Maybe this is overkill, but I am trying to
1. open a Modal window, when a link is clicked in UI-Grid
can be done by modifying http://ui-grid.info/docs/#/tutorial/110_grid_in_modal
2. Put a (ui.bootstrap.datepicker) inside the Modal
3. Retrieve the chosen date
4. update the Date Cell in that UI-Grid Row
so, Is Ui-Grid 'well suited'/'can do this' given the above requirements
tia

Nope, not overkill. You can do this with UI-Grid pretty easily. There's a guide on how to do hook up modal editors using Angular Schema Form here: http://brianhann.com/create-a-modal-row-editor-for-ui-grid-in-minutes/ (caveat: I'm the author).
I've also created a new plunker that uses the angular-schema-form-datepicker library to show how you might do this: http://plnkr.co/edit/7t3BI2AUcnvNfav78Btr?p=preview
(plunker has been throwing 404s for files that are part of a plunk so you might have to refresh it)
The main things you have to do are set up your object schema:
scope.schema = {
"type": "object",
"properties": {
"myDate": {
"title": "My Date",
"type": "string",
"format": "date"
}
}
}
Using the same property as your column Defs:
columnDefs = [
{ field: 'myDate', name: 'My Date' }
]
And specify your date format in your form:
form = [
{
key: 'myDate',
format: 'yyyy-mm-dd'
}
]

Related

How do I define a custom snippet using VScode "Surround" extension

I'm using a VScode extension called "Surround"
In the docs for this extension it shows how to define a custom snippet. What I want is really simple. I would like to add the ability to surround selected text with tags, ie <> </> while placing the cursors in the middle where I define what type of tag that is (html, img, button, etc)
The docs show this example:
{
"surround.custom": {
// command name must be unique
"yourCommandName": {
// label must be unique
"label": "Your Snippet Label",
"description": "Your Snippet Description",
"snippet": "burrito { $TM_SELECTED_TEXT }$0", // <-- snippet goes here.
"languageIds": ["html", "javascript", "typescript", "markdown"]
},
// You can add more ...
}
}
I can almost parse it, except I don't know what the placeholders are representing. I assume { $TM_SELECTED_TEXT } is the text I've selected but what is the trailing $0 used for? Also, how can I place 2 cursors in between the opening and closing tags?
Thanks in advance.

acf_register_block_type did not show up in frontpage

I recently created a custom block type with acf like mentioned in the doc, it works just fine in the edit interface in the back-office, but in the front I did not get anything, and when i inspect the html code i get the content commented like this:
<!-- wp:acf/highlighted-posts { "id": "block_5e97574edd1fa", "name": "acf\/highlighted-posts", "data": { "titre": "", "_titre": "field_5e972e607d71e", "read_more": "", "_read_more": "field_5e973516c767d" }, "mode": "preview" } /-->
Any ideas please ! ?
For anyone who is facing this issue: you must use the WordPress Built in function the_content(), otherwise the content will not be parsed correctly. Or you can use the method parse_blocks(), more information’s in the following link :
https://developer.wordpress.org/reference/functions/parse_blocks/

Is it possible to change the name of the contributed view from VS Code extension

package.json of the VS Code extension defines custom view to show structure of the project:
"contributes": {
"views": {
"explorer": [{
"id": "myProjectView",
"name": "<<PROJECT NAME PLACEHOLDER>>",
"when": "myProjectView:inProjectFolder"
}]
}
},
activate() method of the extension reads project file.
One of the file attributes is the project name.
QUESTION: Is there a way to set this name as the view name replacing the one, defined in package.json?
Yes, you can dynamically change it via TreeView.title. To do this you first have to obtain a TreeView instance using window.createTreeView():
let view = vscode.window.createTreeView("myProjectView", {treeDataProvider: provider});
view.title = "New Name";

Navigate to the same view but with a different parameters

I'm trying to create a launchpad app using a list of tiles, the problem is that when I click in a tile it could be a app then I navigate to app url or it could be an group of apps or other groups than I need to navigate to the same view of the launchpad but with a new list of tiles. For now, I just want to navigate to navigate to the same view when I click in a tile and do it with slide transition but if I create a route with the same target of default route the view does not render when I start the application, it only works if I ser the target of the route when I create an other target with the same view name.
where is a part of my manifest:
"routes": [
{
"pattern": "",
"name": "group",
"target": "group"
},
{
"pattern": "group",
"name": "group2",
"target": "group2"
}
],
"targets": {
"group": {
"viewName": "TileGroup",
"viewLevel" : 1
},
"group2": {
"viewName": "TileGroup",
"viewLevel" : 2
}
}
}
ans here the controller of my TileGroup view for now.
sap.ui.define([
"sap/ui/core/UIComponent"
],
sap.ui.controller("pelissari.soficom.launchpad.controller.TileGroup", {
onInit: function() {
var oModel = new sap.ui.model.json.JSONModel();
oModel.loadData("./model/data.json");
this.getView().setModel(oModel);
},
onPress: function (oEvent) {
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.navTo("group2");
}
}));
With this code I think that the navigation is working because the url of the app changes when I click in a tile but the view do not change.
If you are seeing the URL being changed, then you have the first part of the solution ready. The only thing is that you shouldn't navigate to a new target. Instead, you should navigate to the same target, but passing another tilegroup identifier using the second parameter of the navTo method, e.g.:
oRouter.navTo("tileView", {group: "group1"});
The second part involves getting an event raised in your controller whenever the URL changes, so that you can act on the change.
To catch the ID passed using the navTo method, you should change the route pattern in your manifest accordingly, e.g.:
"pattern": "tiles/:group:"
tiles indicates a fixed part in your URL, while :group: specifies an optional parameter called group. If you want to do this from the root (I think that's what you planned to do), it should be
"pattern": ":group:"
To inform the router that you want to get triggered when the URL changes, you can set a call-back. You can do so by inserting the code below into the onInit handler of your controller:
var oRouter = sap.ui.core.UIComponent.getRouterFor(this);
oRouter.getRoute("group").attachPatternMatched(this._onPatternMatched, this);
When this is in your onInit handler, the _onPatternMatched handler is invoked when there was a change in the URL that involves target group. The latter is useful, otherwise your method would get triggered for every URL change, even when the view linked to your controller is not visible.
From the _onPatternMatched method, you should read back what the group ID is that should be displayed, so that you can change the tiles. You can do this by reading the arguments parameter from the event parameter:
_onObjectMatched : function (oEvent) {
var groupId = oEvent.getParameter("arguments").group;
console.log("Group ID: " + groupId);
},
The essentials of routing are very well explained in the UI5 walk-through step 31, 32 and 33. Please especially take note of part 32, which explains routing with parameters.

How to set default value for FilteringSelect widget in Dojo Data Grid?

I am trying to display dynamic values read for a store as options within a filteringSelect widget in my DOJO Data Grid. The values are getting populated as expected however, I am unable to display a default value when the grid loads, right now it shows up as "..." on single click, I am able to see a drop down.
Below is the location of the sample code:
http://jsfiddle.net/R64bE/2/
I want to iterate through my "myStore" in the code above and make the item with label = 'Y' as the default for that filteringSelect.
I want the default value displayed as soon as the grid or filtering select is rendered. Any pointers or sample code will be of great help.
Glad that I was able to fixed it too..Below is the code in case anyone wants to achieve something similar.
Working code with Default value
Basically all I had to do was send a default value for that field/cell in the first json I created.
jsonStore = new dojo.data.ItemFileWriteStore({
data: {
"identifier": "identify",
"label": "description",
"items": [
{
"identify": 123,
"description": "Project Manager",
"billingMethod":"Sample"},
{
"identify": 234,
"description": "Developer"},
{
"identify": 536,
"description": "Developer"}
]
}
});
Notice that all I had to do was add a value for that column in the json, i.e., for Billing Method Column, I added "billingMethod":"Sample" and it picks it up from there.
Cheers