Take data from listGrid
Hello,
I'm new in that forum, and my english is very poor, but I have a problems with backbase and I can't find the solution in that web or google.
I have Bacbase Comunity edition 4.1, and I can't use btl.dataBinding.getValue function, and I can't use, oGrid.aLocalIndexes[] array.
When I change the value of the listGrid, the debugger error is this:
1: GENERIC: Javascript error: "oGrid.aLocalIndexes has no properties".
If in the code, I write a number, and drop oGrid.aLocalIndexes, the error is this:
1: GENERIC: Javascript error: "btl.dataBinding.getValue is not a function".
I don't know why are the problems.
Under is the code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Backbase - Introductory Tutorial</title>
<script type="text/javascript" src="../client_4_1/engine/boot.js" ></script>
</head>
<body>
<script xmlns="http://www.w3.org/1999/xhtml"
xmlns:d="http://www.backbase.com/2006/tdl"
xmlns:c="http://www.backbase.com/2006/command"
xmlns:e="http://www.backbase.com/2006/xel"
xmlns:b="http://www.backbase.com/2006/btl"
xmlns:xi="http://www.w3.org/2001/XInclude" type="application/backbase+xml">
<xi:include href="../client_4_1/bindings/config.xml?uich=<?=mt_rand(1000,9999)?>" />
<b:listGrid id="listGrid" rowClasses="rowClass1,rowClass2" name='listGrid' rows='5' width='500px'>
<b:dataSource e:behavior="b:localData" dataType="application/xml">
<b:dataContainer>
<xi:include href="listGrid03_data.php?<?=rand(1,1000)?>" />
</b:dataContainer>
</b:dataSource>
<b:listGridCol label="Id." select="@id" width="60px" readonly="false" display="true" >
<b:fieldEditor>
<input />
</b:fieldEditor>
</b:listGridCol>
<b:listGridCol label="izena" display="true" select='izena'>
<b:fieldEditor>
<input />
</b:fieldEditor>
<e:handler event="change" type="text/javascript">
var oGrid = bb.document.getElementById('listGrid');
var iIndex = bb.getProperty(oGrid, 'selectedIndex');
sQuery='izena';
alert(btl.dataBinding.getValue(oGrid,0,sQuery));
</e:handler>
</b:listGridCol>
</b:listGrid>
<b:pagerBar width="400px">
<b:pager for="id('listGrid')" width="250px">
<b:pagerButton type="First" />
<b:pagerButton type="Previous" />
<b:pagerSeparator />
<b:pagerJumper />
<b:pagerSeparator />
<b:pagerButton type="Next" />
<b:pagerButton type="Last" />
</b:pager>
</b:pagerBar>
</script>
<div id='receiver' />
</body>
</html>
<head>
<title>Backbase - Introductory Tutorial</title>
<script type="text/javascript" src="../client_4_1/engine/boot.js" ></script>
</head>
<body>
<script xmlns="http://www.w3.org/1999/xhtml"
xmlns:d="http://www.backbase.com/2006/tdl"
xmlns:c="http://www.backbase.com/2006/command"
xmlns:e="http://www.backbase.com/2006/xel"
xmlns:b="http://www.backbase.com/2006/btl"
xmlns:xi="http://www.w3.org/2001/XInclude" type="application/backbase+xml">
<xi:include href="../client_4_1/bindings/config.xml?uich=<?=mt_rand(1000,9999)?>" />
<b:listGrid id="listGrid" rowClasses="rowClass1,rowClass2" name='listGrid' rows='5' width='500px'>
<b:dataSource e:behavior="b:localData" dataType="application/xml">
<b:dataContainer>
<xi:include href="listGrid03_data.php?<?=rand(1,1000)?>" />
</b:dataContainer>
</b:dataSource>
<b:listGridCol label="Id." select="@id" width="60px" readonly="false" display="true" >
<b:fieldEditor>
<input />
</b:fieldEditor>
</b:listGridCol>
<b:listGridCol label="izena" display="true" select='izena'>
<b:fieldEditor>
<input />
</b:fieldEditor>
<e:handler event="change" type="text/javascript">
var oGrid = bb.document.getElementById('listGrid');
var iIndex = bb.getProperty(oGrid, 'selectedIndex');
sQuery='izena';
alert(btl.dataBinding.getValue(oGrid,0,sQuery));
</e:handler>
</b:listGridCol>
</b:listGrid>
<b:pagerBar width="400px">
<b:pager for="id('listGrid')" width="250px">
<b:pagerButton type="First" />
<b:pagerButton type="Previous" />
<b:pagerSeparator />
<b:pagerJumper />
<b:pagerSeparator />
<b:pagerButton type="Next" />
<b:pagerButton type="Last" />
</b:pager>
</b:pagerBar>
</script>
<div id='receiver' />
</body>
</html>
Sorry but... I can't write better in English.

sorry
13 November, 2007 - 11:57 — uuriensorry, I forget says that I also try with:
<b:listGrid id="tett"
13 November, 2007 - 13:45 — cerverg<b:dataSource e:behavior="b:localData" dataType="application/xml">
<b:dataContainer>
<xi:include href="../explorer/examples/data/gridData.xml" />
</b:dataContainer>
</b:dataSource>
<b:listGridCol select="title" label="Title" width="150px">
<b:fieldEditor>
<input id="dsa" name="gbf" type="text" >
</input>
</b:fieldEditor>
</b:listGridCol>
<b:listGridCol select="genre" label="Genre" width="100px">
<b:fieldEditor>
<select onchange="alert('index:'+bb.getProperty(bb.document.getElementById('tett'), 'selectedIndex'));alert('value:'+this.value);">
<option value="" />
<option value="Action">Action</option>
<option value="Adventure">Adventure</option>
<option value="Crime">Crime</option>
<option value="Drama">Drama</option>
<option value="Horror">Horror</option>
<option value="Thriller">Thriller</option>
<option value="War">War</option>
</select>
</b:fieldEditor>
</b:listGridCol>
<b:listGridCol select="premiere" label="Premiere" width="90px">
<b:fieldEditor>
<b:calendar mode="popup" />
</b:fieldEditor>
</b:listGridCol>
<b:listGridCol select="rating" label="Rating" width="80px" align="right">
<b:fieldEditor>
<b:slider showLabels="false" />
</b:fieldEditor>
</b:listGridCol>
<b:listGridCol select="price" label="Price" width="70px">
<b:fieldEditor>
<b:spinner stringBefore="$" step="1" decimals="2" />
</b:fieldEditor>
</b:listGridCol>
</b:listGrid>
I hope that's a bit helpful you can get the index and the changed value.
thanks
13 November, 2007 - 14:02 — uurienwow thanks a lot!!!! With this info I can sincronize database data with listGrid data. Thanks
Hi, In Backbase 4.1,
13 November, 2007 - 17:05 — gaoHi,
In Backbase 4.1, getValue function's signature is:
A sample usage could be:
var oGrid = bb.document.getElementById('myListGrid');
var iIndex = oGrid.getProperty('selectedIndex');
var sQuery = 'yourQuery';
sValue = btl.dataSource.getValue(oSource, iIndex, sQuery);
alert(sValue);
Hi,
20 November, 2007 - 10:57 — uurienHi,
Thanks gao but... with this method, I haven't in sValue the newest value of listGrid. If I change "value1String" in listGrid, and I write, "val2", sValue-s value is "value1String".
var oSource = bb.document.getElementById('myDataSource');
var oGrid = bb.document.getElementById('myListGrid');
var iIndex = oGrid.getProperty('selectedIndex');
var sQuery = 'name';
sValue = btl.dataSource.getValue(oSource, iIndex, sQuery);
alert(sValue );
</e:handler>