Is there a way in the style sheet to get a tableview form onShow or if loaded without the background-color and font-color for selected, but with it if I click on a row for selecting a record?
I mean if I load/show first time a tableview list nothing should be highlighted as selected. First I select a record manually (or by function) it should be displayed as selected.
I have onRender(), by defualt first record gets selected that is background color of frist record changes in tableview. I want record should get selected(change the background color) only once user selects the row. Below is the code snippet for onRender().
function onRender(event) {
if (event.isRecordSelected()) {
event.getRenderable().fgcolor = ‘#3566D5’;
}
}
Is there any way we can change the color of record only when user selects the record. Any suggestion is appreciated.
Thanks Don,
Yes exactly, by default pointer points to first record in foundset whether selected or not. Still is there any solution to highlight entire record in table view only when user selects the record.
Any one has any solution let us know. That would be a great help.
I am thinking to add a dummy record and load all the records along with other required records in table and hide dummy record at runtime and set some flag to that record so that OnRender() highlights dummy record. But I don’t know how to hide entire record in foundset/table view. Does any know how to hide record in table view/foundest. That will be appreciated.
mskv1309:
Any one has any solution let us know. That would be a great help.
I am thinking to add a dummy record and load all the records along with other required records in table and hide dummy record at runtime and set some flag to that record so that OnRender() highlights dummy record. But I don’t know how to hide entire record in foundset/table view. Does any know how to hide record in table view/foundest. That will be appreciated.
We’ve tried a bunch of things and it is currently not possible to do without a lot of work.
Ok. May I know in brief how is it possible to accomplish. Is it through javascript or can we do in HTML, how can we do. I would like to know, if possible.
Web client only solution. Involves a bunch of post rendering client-side javascript.
onRender() won’t help you at all. It fires a number of times per table view so almost impossible to write code in it that targets a particular record beyond selected, even and odd.
Method names correspond to the form events of whatever table view you want this to work on. 20 second video of this in action here: http://www.youtube.com/watch?v=ZMtXLAIr6jI
Works great in web client – a little dodgy in smart client as I didn’t spend any time with it fine tuning. Still lodge a feature request with Servoy. One line of code as compared to all this…
The real value of this exercise for us was figuring out that code in the onRender event can be controlled above and beyond the standard event states via form variables. Might come in handy someday.
/**
* Track last record index.
*
* @type {Number}
*
* @properties={typeid:35,uuid:"A59AE8F4-8C19-4E39-ACC9-B2DB24E1A2AB",variableType:4}
*/
var _index = null;
/**
* Track first show state of form.
*
* @type {Number}
*
* @properties={typeid:35,uuid:"C737D741-9579-4C6D-9A2A-3A25B5AE60D7",variableType:4}
*/
var _firstShow = null;
/**
* @properties={typeid:24,uuid:"B9BFB294-B3A8-4C12-A2E2-6C227BDC25AB"}
*/
function onShow(firstShow, event) {
// if table in related form, onRecordSelection event of parent form should
// set these same form variables to same initial values
_firstShow = 0
_index = 1
}
/**
* @properties={typeid:24,uuid:"94ABDB15-1D59-47AA-BE2F-6392C3CE18A2"}
*/
function onElementFocusLost(event) {
_index = controller.getSelectedIndex()
}
/**
* @properties={typeid:24,uuid:"13BA49DC-4B7D-45AF-913A-80ED8AD71E5B"}
*/
function onElementFocusedGained(event) {
if ( !_firstShow ) {
// setDesignMode() forces full UI redraw in web client so only do if
// if clicking same record
if ( controller.getSelectedIndex() == _index ) {
// hack to force onRender to fire when selecting a record that is already
// the current index
// (onRecordSelection event doesn't fire in this case...ergo, onRender doesn't fire)
controller.setDesignMode(true)
controller.setDesignMode(false)
}
_firstShow = 1
}
}
/**
* @properties={typeid:24,uuid:"4F331175-1E08-415A-88B7-1BFD59D05D2D"}
*/
function onRender(event) {
// event that overrides form css for selected
// only fire if first time (tracked in form variable: _firstShow)
if ( !_firstShow && event.isRecordSelected() ) {
event.getRenderable().bgcolor = '#ffffff' // non-selected color
}
}