Thanks,
Jim
On 5/2/06, Chris Esler <[EMAIL PROTECTED]> wrote:
to see how the object is formulated, use JSON to convert the object to a string then output to an alert() so you can see how it is laid out. See attached file for JSON.
that way you can see the indices you need to access.
/*
Lets assume your list is set up like this:
*/
myList_ld = [];
omyList_lc =
{
id : { label : "Id", width : "10%", type : "text", sortable : true, sortProp : "text", align : "center" },
name : { label : "Name", width : "50%", type : "text", sortable : true, sortProp : "text", align : "left" },
date : { label : "Date", width : "40%", type : "text", sortable : true, sortProp : "text", align : "left" }
};
myList_lv = new QxListView(myList_ld, myList_lc);
myList_lv.setBorder(QxBorderObject.presets.shadow);
myList_lv.setBackgroundColor("white");
myList_lv.setWidth(350);
myList_lv.setHeight(200);
myList_lv.setLocation(20, 38);
myList_lv.getPane().getManager().setMultiSelection(false);
/*
then to see how the items structure is setup, run it through JSON
*/
var myList_sel = myList_lv.getPane().getSelectedItem();
alert("ID :: "+JSON.stringify(myList_sel));
/*
this should give you
*/
{"id":{"text":"36"},"name":{"text":"04-25-2006"},"date":{"text":"test"},"_lead":true,"_anchor":true,"_hashCode":1352,"_hash":1352,"_selected":true}
/*
now I know how my object is setup to access the data.
Assuming we want to access the "id" field, I can can change the alert() to the following
*/
alert("ID :: "+myList_sel['id'].text);
/*
this should give you the id column data of your data set since I know what the indice is now
*/
Hope this helps...
--
Best regards,
Chris Esler
www.chrisesler.comOn 4/23/06, Jim Hunter < [EMAIL PROTECTED]> wrote:Thanks for the info. When I first wrote this reply I had not yet figured out your other post with regards to adding my own index value to the row. I was trying to determine how to get that value back out of the row and was failing. But this is what I learned: I had to access the index property like this:
x=this.getPane().getManager().getSelectedItems();
row=x[0].__index.text;
but as you can see, I needed to know the name of the row property in order to reference it. I tried to do something like x[0][2] to access the third column data but it didn't work. Lets say I simply need to iterate through all the columns/properties of the selected rows to get data to pass to another function, what is the easiest way to do that? Right now I only had a need to have an index value and I have that solved with your assistance. Now I am going to tackle the pre-selected flag and then a row color flag which I suspect will both be handled in the same way.
Thanks again,JimOn 4/23/06, Benjamin Reitzammer <[EMAIL PROTECTED]> wrote:
Jim Hunter wrote:
> This information is nice but it still doesn't tell us what we can DO
> with getSelectedItems(). In one of the demo's I think I saw that you can
> do a getSelectedItems().getData(), but no information on what you can DO
> with the returned data. I would love to see some code snippet showing
> how to access the second fields data of the second row selected assuming
> that 3 rows were selected. A simple alert would do. All of my ListViews
> are dynamically created at run time and I have no idea at design time
> what fields are going to be in a ListView so I need to be able to access
> the information generically. I tried to do something like
> getSelectedItems().getData()[0], trying to reference the first row
> selected but got a _javascript_ error.
You got an error, because it must be getSelectedItems()[0] .... the
getData() method only works on the QxListView instance ... or on your
QxData event that you receive when you listen on the "changeSelected"
event of the listviewpane's selection manager ... depending on how you
get to the data of the selected items ... maybe you want to add the
following snippet to your app and see what happens (may contain syntax
errors, sorry for being too lazy to test it)
listView.getPane().getManager()
.addEventListener("changeSelection",
function(e) {alert( e.getData().length +" "+ e.getData()[0]) }
);
> There really is no information in
> the demos that tell you how to manipulate the raw data. The examples
> that move data from one grid to another never drill down into the data,
> the leave it as a whole entity. So far I have read as many posts as I
> can and looked at the demos but I see no information that is relevant to
> what I need to do. Someone out there has had to have done this before
> and can show others how it's done.
Ok, now because I can't keep my mouth shut ... tell me an exact example
what you want to do (e.g. change one column of data at runtime,
manipulate just the selected rows of a list), so I get an idea what you
are looking for, and I'll try to do a short writeup with an extended
example.
Cheers
Benjamin
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Qooxdoo-devel mailing list
Qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel