my react grid has a some row values that depends on state (Actually has a slider column).
But i need to show new slider value after state changed by slider. I did it by call redrawRows() because refreshCells() is not changing cell value as state. refreshcells is does nothing into slider.
redrawRows working good but losing mousedown event on slider. i changing slider value with mouse and slider's mousedown handling is lost after redrawRows. I must re press mouse button on every slider value change
Why refreshCells does not update cell value?
For the refreshCells to work, your slider cell renderer component should implement refresh() method.
As per the docs -
To handle refresh, implement logic inside the refresh() method inside
your component and return true. If you do not want to handle refresh,
just return false from the refresh method (which will tell the grid
you do not handle refresh and your component will be destroyed and
recreated if the underlying data changes).
Refresh Cells: api.refreshCells(cellRefreshParams) - Gets the grid to
refresh all cells. Change detection will be used to refresh only cells
who's display cell values are out of sync with the actual value. If
using a cellRenderer with a refresh method, the refresh method will
get called.
In your case, it may be possible that the refresh method is not being called.
Please read more on cell renderer component life cycle here
Related
I have a uitable with a checkbox column.
I want to toggle the checkbox status for each selected cell. Clearly, that does not work when the callback function executes when the user is still adding cells to the selection.
It should rather execute not earlier than the user releases the mouse.
The normal behaviour of a cell selection callback function however fires every time the selection area canges.
How can one change this behaviour?
A
I have a button inside each cell. When it's pressed, the image is changed (basically a checkbox) to denote a selection. When you scroll to the bottom ... then scroll back up to the top. The image is reverted to the original image.
This question is pretty similar to this:
Preserve Cell Image After Scrolling UITableView
And others. But, I can't seem to find a good answer. I understand that's it's reverting back to how the uitableview is setup when the cell goes off the screen. But, how do I save the changed image to the uitableview so when it scrolls it doesn't revert to the original?
Thanks in advance! =)
It's changing back because cells are reused. When your cell is going off the screen it is taken out of the view and put back into the reuse pool. Then you're getting it out of the queue again in cellForRowAtIndexPath and setting it back up as the default.
The question you linked to is exactly what you should follow. You should store the state of your cell in your view controller and then when you set it up again in cellForRowAtIndexPath you should load that state and set up the cell appropriately.
One simple way for your method would be to have an NSArray which you set up to be the same size as the number of rows in your table and then in that just store an NSNumber for each row which contains a boolean value on or off for your selection state. When the user toggles, toggle the value in the array and then in cellForRowAtIndexPath read that value and set it up appropriately.
I'm assuming the checkbox in your table view cell is changing state to a selected state because a user selected it. You shouldn't use UI elements to maintain the state of your app. That is, when the user taps the checkbox, you should use that event to somehow reflect that state change in a data object in your app. Then, when that cell needs to be displayed again, you configure it with the state you previously saved. This allows for things like cell reuse, and view unloading and is all-around a good habit.
I have a UI slider that is continuous. I take the value as it changes and use it to calculate a value that i put into a textfield.
I have the value changed outlet linked to the method that does the calculation and that works ok but i also want a method to fire once the user lifts off the slider that effectively gives a once time evaluation of the final set value.
I have tried connecting the the did end on exit method and others available .
Use the UISlider's UIControlEventTouchUpInside event and, if necessary the UIControlEventTouchUpOutside event. These events will be triggered when the user lifts their finger off the UISlider. Which one is called will depend on whether the finger is inside or outside the bounds of the UISlider when it is lifted.
i am new developer on iphone i need your help to do my application.i display all received messages on tableview and place a slider on right side in that slider i write some names (world,continent,state,city,region,10miles and 50miles)when selecting any value on the slider (state is selece state wise messages will display) programaticaly how it is possible.
Don't use a slider, use a segmented control. Sliders are for adjusting a single continously variable value. Have the segments named world,continent,state,city,region,10miles and 50miles.
Before displaying the messages, loop through them and set up an array of the messages for each of the options.
Link the segmented control to an IBAction in your view controller. When it gets called, call reloadData on the table view which shows your list of messages.
In your cellForRowAtIndexPath method, use a case structure to select the array from which to assign the text on the cell depending on the value of segmentedControl.selectedSegmentIndex
I have a custom UITableViewCell that contains a UISlider control and a UILabel which shows the current text value for the slider position. I want to update the label as the slider knob is dragged. Here are the basic elements.
cellForRowAtIndexPath:
This routine takes data and updates the slider value and the label associated with it.
sliderValueChanged:
This routine reads the slider value updates the data.
It then calls [table reloadData] so the label gets updated.
Problem:
Somehow the reloadData is interrupting the flow of updates. If I substitute NSLog instead of reloadData I get a nice stream of updates showing the value of the slider. In an attempt to prevent looping I put in tests to not set the slider value or call reloadData unless the value was different. That didn't fix things.
Any help would be greatly appreciated!
The problem is being caused by the [table reloadData] which appears to be creating a new Cell object so updates the same slider aren't working. The correct implementation was to get the referenced cell inside the sliderValueChanged routine and set the label from there. Set a tag to the slider to indicate the row and then call the method to get the cell with the index path.
Stuff like this happened to me. Go to build settings and look for a compiler flagged called "Enable floating point library calls". Make sure it's disabled. See if that helps you.