how to filter data in dcjs/crossfilter on selection of datatable row? - crossfilter

I have seen most of the examples of dc.js which filters the data using brushes. How should i filter the data using the row element selected from datatable??
I am not sure of exact solution but some workaround may be done as
dimension.filter(value)
where value updated onclick? Am I going in right direction or is there a better way?
Edit 1
If i draw a row chart of the same thing with the then I don't have to handle onlcick event or anything but for datatable why is it comparatively so much complecated?

That should work. You will have to trigger the redraw events to the charts know about the change.

yes I put a onclick="function(value)" button.
and
window.function(value){
table.dimension(dimension);
table.filter(value);
table.render();
}
PS: I am not proficient in dc.js so this method might not be a optimal solution

Related

Meteor dynamic input fields

I'm looking for a way to create dynamic input fields in Meteor.js. I've chosen not to use Aldeed's Autoform for greater control over the code. From front end point of view I have no issues to add dynamic fields with +/- button to add and remove fields. What I'm struggling with is the insert statement on the back end. How can one add dynamic insert in Meteor.js? Cheers!
Essentially you need a reactive array of element that's rendered to the DOM via {{#each}} ... {{/each}}. When the array changes the DOM would re-render.
There's no need to create your own reactive array, there's one here with an example that does exactmy what you're asking for:
http://reactivearray.meteor.com/
However I'd recommend going one step further and using the ViewModel package for this (by the same author). Here's an example which shows how to use it to insert fields:
http://viewmodel.meteor.com/#contacts
Tim
Thanks Tim, these are both pretty useful. I'm using Collection 2 so decided to use objects ('object.$'). This is easy solution for me. cheers.

Selecting a row in a dataframe in RGTK2

I want to perform something like the one below:
display a dataframe in RGTK2 window, with scrollbar on the right
user can select the specific row in the dataframe by clicking on it, and I can "get" which row the user has actually clicked
I wonder if this can be done using RGtk2. Thanks.
Yes, of course. Have a look at: https://github.com/jverzani/gWidgets2RGtk2/blob/master/R/gtable.R . You can pull out most of the first request in the initialize method and the second in the set_selected and get_selected methods. The task is made much easier (and faster!) by Michael Lawrence's rGtkDataFrame constructor to turn data frames into models that RGtk2's views can use quite easier.

Change a value in a dynamically generated drop down list

Ok so I have drop down list connected to a datasource, and I need to change 2 or 3 of the values before they are displayed and I'm just having trouble figuring out what to do. I'm assuming I setup some kind of loop to check the values, but thats all I can figure. Does anybody have any general suggestions or resources they know that I can look up? Thanks.
You need to do your processing before you bind the datasource. So for example, create a dataset of results or arraylist, process the results changing your values and then bind to your dataset/arraylist.
You'll need to be more specific about what you are binding to and how you want to process for me to be more specific..
See link at http://www.c-sharpcorner.com/uploadfile/sd_patel/dropdownlistbox11222005064123am/dropdownlistbox.aspx

DataGrid edits label instead of data

I have an editable DataGrid in Flex, with data full of numbers. The columns have no special itemRenderer, but a labelFunction, which returns the number as-is if positive, but puts it in parentheses if it is negative, like so
27.3 => "27.3"
-27.3 => "(27.3)"
Now, these cells are editable. When I try to edit a cell with a positive number, nothing is wrong. But if I try to edit a negative number, it starts editing (27.3) instead of editing -27.3. Because of this, when the edit is done, the labelFunction is evaluated with the new value in parentheses(i.e., labelFunction is called with "(30.5)"), and converting it to a Number results in NaN.
So, I want to know if I can make the DataGrid edit the data in the dataProvider instead of the label that it shows.
I hope I am clear with the condition. Please ask if you need any clarification.
Thank you.
Is this what you're after?
Example: Modifying data passed to or received from an item editor - From livedocs.adobe.com
(You may still have to scroll down once the page loads... The anchor doesn't seem to be working for me.)

Gridview Sorted Event

I've very small question that drives me mad :)
I've a Gridview (bind from db nothing special there) and I use small function that runs on the griviewrows and sets .Visable to false in case they don't match search criterias. It works fine but when I try to sort the grid view (by clicking on the header) all the "hidden" rows shows up again.
I tried to use the "GridView_Sorted" event in order to run on the gridview and hide again but it doesn't seem to do anything. The select statement is stored procedure so I can't use filtering expressions.
My Question is - Is there a way to run the hiding function after the sort
(as "Occurs when the hyperlink to sort a column is clicked, but after the GridView control handles the sort operation." {http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.sorted.aspx} suggests )
The GridView's PreRender event should do the trick.
You could just walk GridView.Rows and apply your logic there... That way it's guaranteed to occur at the right time wether the sort happens or not.
How are you binding the data?
Maybe it would help only to bind the used data (rows) to the grid, because binding not displayed data is kind of an overhead.

Resources