Drag and drop

Hi,
I have a few questions to ask. first how do i drag a row of data from a listgrid?
Secondly, assuming I want to display an image in response to a click on a row from the grid how would I achieve that? The url is not displayed on the grid but is contained in an xml file used to display the grid.

Drag and drop

Hi,

The tricky bit with getting an reference from your listGrid is getting the correct row.

This is something I use which takes the aLocalIndexes from the listGrid. aLocalIndexes is the array of the rows from the dataSource that keeps track of the rows when sorting:

<b:listGrid dataSource="mySource" height="100%" rowClasses="rowClass1, rowClass2" id="listGrid">
<e:handler event="click" type="application/javascript">
        var oListGrid = bb.getControllerFromView(document.getElementById('listGrid'));
        var index = oListGrid.aLocalIndexes[bb.getProperty(oListGrid, 'selectedIndex')];
        alert(oListGrid.aLocalIndexes);
        alert(btl.dataBinding.getValue(bb.getElementById('mySource'), index, '@id'));
</e:handler>

        <b:listGridCol query="title" label="Title" width="200px"></b:listGridCol>
        <b:listGridCol query="genre" label="Genre" width="100px">
                <b:editor>
                        <select>
                                <option value=""></option>
                                <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:editor>
        </b:listGridCol>
        <b:listGridCol query="rating" label="Rating" width="70px" align="right">
                <b:editor>
                        <b:spinner></b:spinner>
                </b:editor>
        </b:listGridCol>
</b:listGrid>

My dataSource looks like this:
<e:variable name="varData" xmlns:e="http://www.backbase.com/2006/xel">
  <e:data type="text/xml">
    <movies totalRecords="3">
      <movie id="film-0">
        <new></new>
        <title>The Seven Samurai</title>
        <genre>Drama</genre>
        <rating>88</rating>
      </movie>
      <movie id="film-1">
        <new></new>
        <title>City of God</title>
        <genre>Drama</genre>
        <rating>88</rating>
      </movie>
      <movie id="film-2">
        <new></new>
        <title>The Godfather</title>
        <genre>Crime</genre>
        <rating>91</rating>
      </movie>
    </movies>
  </e:data>
</e:variable>

I think with that you could get the url and set it somewhere to load it.

problem

alert(btl.dataBinding.getValue(bb.getElementById('mySource'), index, '@id'));
the above bit of code doesn't work. I keep getting an error message that says "oDOController has no properties"

Drag and drop

Hmmm... that is strange. The only thing that is not there is the dataSource. This is what I use for that.
Include the xml file:

<xi:include href="yourFile.xml"/>

And the dataSource:
<b:dataSource id="mySource" name="mySource" type="xml" select="$varData"/>

Let me know if that changes anything.

mispelling error

Hi,
I had actually mispelled my id within the dataSource. Thanks

how do we drag a litsgrid

how do we drag a litsgrid item ?
where do we have to define the property e:behavior="b:drag" ?

how do we drag a litsgrid

At the moment it is not possible to drag listgrid items in a listgrid. I have entered it as a feature request. At the moment we are trying to improve our drag system so I am pushing for also ways to make these things possible.

Thanks

I had the same question. Thank you for your help!!!