I have a list of Task objects.
I have a template which contains a modal form to edit a task.
When a user clicks the link to a single Task I want to set the task to be edited to the Task that was clicked and then render the form.
I'm trying it with reactive variables and Tracker.depend. But I haven't quite gotten it working yet. The data on Template.taskUpdateForm doesn't get set properly.
Please see this commit to see what I'm working on.
https://github.com/laran/eisenhower/commit/e89890d49f5b772849d09fd1f719a6cdafa58125
When you click on a task to edit, just store it's _id or the whole task in a Session variable, and in the helper function for your modal use that same session variable. No need to worry about Tracker depend. This always works for me.
I was setting the selectedTask to the wrong thing. I just needed SelectedTask.set(this.task) instead of SelectedTask.set(this)
Related
I would like to do some interesting stuff with the hits that are being displayed based on the search query that user is not only typing into search box but actually filtering using the instant search filters. I have filter based on hierarchical events_location taxonomy. Based on what user selected I would get the info in JS variable that I can then further use to do other operations in the hits div, specifically on each hit card.
So my URL when searching updates like this:
/what-to-see/?q=&idx=sdbeta_posts_events&p=0&hFR%5Btaxonomies_hierarchical.events_calendar.lvl0%5D%5B0%5D=JUL%204&hFR%5Btaxonomies_hierarchical.events_category.lvl0%5D%5B0%5D=All&hFR%5Btaxonomies_hierarchical.events_locations.lvl0%5D%5B0%5D=Paddock%20Stage
I could potentially take the URL and extract the data from it, but I am sure there is more elegant way of working with the query.
In InstantSearch.js, the state is managed by another library called the algoliasearch-helper. Through this library you can read and write the search parameters.
The cleanest to access the helper is to build a custom widget, which is a plain object with lifecycle hooks (initial rendering and the other renderings). You can read more about custom widgets there.
Once you've accessed the helper, you can read and write with the helper API.
This can be found under search.searchParameters
So:
console.log(search.searchParameters);
Will give you whole object that you can then work with.
There is however one issue with this and that is that it works only on initial load. I was unable to make this work or get any data after starting to selecting categories. So if anyone knows how to use this so it updates after each selection please comment bellow.
I want to update a column by name A which is the output of the case.
Can we use activity for this?
What is the best way to achieve?
I used activity to perform this.
In activity I called a method "Obj-Open" with appropriate step page to get the details of the data page. We need to pass the appropriate key to fetch the particular record.
Then call the Property-Set method in the next step of the activity with appropriate step page. Here set the target and source properties accordingly.
In the next step of the activity call the Obj-Save method with appropriate step page.
Please let me know if there is any other better way to do it
Try using savable datapage in your Flow Action post processing. See my example in the attached screenshot.
I have a template which is a simple edit form. The _id of the document to be edited comes in a session variable (set by mini-pages from the URL: http://example.com/items/4zt4z3t3t). In the Template.editForm.createdfunction I try to get the correponding document from the collection using ItemCollection.findOne({_id:_id}). The _id is set correctly in all cases.
When I navigate to http://example.com/4zt4z3t3t and debug the created function, ItemCollection.findOne()returns undefined, although there are items in the collection. Therefore I can never find my item by _id. Also, when I move the item find procedure to the routing stage, there is also no result for the find. Later on, the colleciton works as expected.
Any pointers?
Meteor uses a Data on the wire principle. This means when your HTML has loaded your data isn't sent along with it, at least initially.
You can't therefore access data in a .created function, unless you expect that template to be loaded after the data has been downloaded. This is why it returns undefined initially but if you check later its there.
You can either, wait for a callback from the subscription on when the data is completed, then load the template.
OR
Use reactivity in your template and let it load empty, and automatically fill it up with data when the data has come in (really the easiest). Access your data in the template and use a handlebars helper to fill in the data and use the .rendered callback to do any changes after.
I am using a command pattern, so any changes to object state need to happen within a command execution. A normal itemeditor in a DataGrid would just make its changes on the underlying bound object, but I need to intercept that change and make it use a command.
I'm pretty new to flex, so I'm looking for ideas of how to implement this. A basic example is that I have an object with a "date" field. In the datagrid I am using a flex "DateField" component as the itemeditor. When I select a new date, I don't want it to update the datasource, I want it to call a different method where I can access the newly selected value and pass it to a command to execute. Any tips would be greatly appreciated. Thanks in advance.
Use the itemEditBegin and/or itemEditEnd events on the DataGrid and build your command in the handler. This page has a few examples of capturing the edit operation with those events.
In my opinion, you're over-engineering this to hell, to the point that it becomes unusable. Why would you need a command to just change data on the fly? I've been doing Flex for 3 years and I yet to see it done this way. The only time commands are used is for receiving information from the server.
Either way, if you really want to implement it (against my recommendation), you would probably want to do event bubbling with a controller listening higher up the display list for the event, then from there trigger a command. From within the item renderer:
this.dispatchEvent(new Event('someEvent', true));
And then higher up the display list:
dataGrid.addEventListener('someEvent', someEventHandler);
And within the handler you can run the command.
Hello friends I have a list box control in my asp.net project.
I want to know how to get selected index to set currently updated item in database.
Please help me with this. Do i need to perform some data base operation to find the key for currently updated data and then i'll have to set it or there exist some property to deal with this? thanks in adavance
One thing to watch out for, which I have come accross more than once is that if you call your CompanyListBox() method in your Page_Load method, you will lose the selected index unless it is only called on the first page load. To make sure of this, place your call to CompanyListBox() within the following block:
if(!Page.IsPostBack)
{
CompanyListBox();
}
You can access the selected index in your postback by using the following code:
var id = (Int32)listCompany.SelectedItem.Value
Then it is up to you to use that in your data access to update the record in the database. Looks to me that you are using some kind of framework or manager class for your database access. The companyManager should have methods for saving your updated item to the database. Good luck.