Displaying data on an laretdialog using titanium and remote database - titanium

i'm developping a mobile app using titanium appcelerator. in my app i have a tableview contains list of persons' name retrieved from remote database. when i click on each row of my tableview, i want to display some other data from remote database (the activity of each person of my list). i used a php web services to do this. i used a loop "For" to display data, but the problem that when i click on a row all data (all activity of persons are displayed). i tried to do this whitout loop, i can display now only one data (on click, only the activity of the first person is displayed for all rows of my tableview). i do not know what exacly should i put as condition or witch loop must be used for this.
Any help please. this is a screenshot of my tableview and the alert dialog: https://www.dropbox.com/s/osan0bb4i6s2bqd/scrennShot.png

You have to add the click EventListner to TableView..
Hope it will works for you...
and Pass the data object to TableRow when its created
var row = Ti.UI.createTableViewRow({
height : Ti.UI.Size,
left : 0,
obj : your_data[i] // From the array etc for specific row .
});
Add EventListner
e.rowData.obj;

Related

Refresh screen data (START-OF-SELECTION)

I'm developing a report with multiple ALVs.
In START-OF-SELECTION I have:
1) data selection
2) ALV display cl_salv_hierseq_table
The lines can be selected through checkbox. When a button is pressed, some tables in DB are updated. After this processing, I have to return to point 2,
BUT the data on the screen has to be updated (point 1). How I can do this?
Thanks.
I think you need to use the REFRESH method of the class.

How can I add row of components to a GUI when a button has been pressed?

I'm putting together an app where a user can record information about like a sale of an unknown number of items in a business. My question is based on recording the quantity, name, individual price and total price of each item sold in a sale. I've already coded a java computer program where I have a table available on the GUI, the user records the information of one item in a table and if they need more rows there is a button which can be pressed each time a new row is needed. I'm wondering:
A) is there a table component I can use in Codenameone on the GUI and
B) can I have the same concept of pressing a button in order to add a new row to the table?
If this isn't possible, because I've had no luck while researching this topic, does anyone have any suggestions of how I can record an unknown number of items for a sale on one GUI page?
UPDATE:
Here is the code which is in the method that adds a new row to the table container.
protected void onSale_ButtonAction(Component c, ActionEvent event) {
Container tbl = findTbl(c);
TextField txt = new TextField();
ComboBox cmb = new ComboBox();
TextField txt2 = new TextField();
tbl.addComponent(txt);
tbl.addComponent(cmb);
tbl.addComponent(txt2);
tbl.animateLayout(300);
}
The button does add the new row but it changes the table layout by resizing all the components and some aren't visible on the screen. I have used the setWidth() method after declaring each component in hope of changing the size of the component but with no luck. How can I solve this problem, so that the new components are the same size as the very first row of components in the table?
And also, after a random number of rows have been filled in with information, i'd like to read this info and save it to a database. I've done this in a computer java program in a JTable and stored the data into a 2D array and then read from the array into the database. Is this method applicable for the container above?
There are "table components" specifically Table, TableLayout & GridLayout.
Adding a row to each of them is somewhat different, lets assume you use a TableLayout container with the container being tbl and having 2 columns:
tbl.addComponent(cmp1);
tbl.addComponent(cmp2);
tbl.animateLayout(300);
Adds both components and animates them into place.

Core data relationships: popup button can select a relationship but the name is not displayed

After a lot of time wasted due to a core data relationship fault, now I'm able to bind a popup button cell to an entity relationship.
The only problem now is that when I select and browse all the options the names are displayed, but when I choose the relationship and click on it, the name disappears.
The entities are very simple:
So a person can have 0 or 1 home, a home can have 0 to N people (inverse relationship).
I have an array controller named "people" which is in entity mode, bound with the people objects of managed object context.Same for "homes", which is bound with the homes objects.All the names in the table views are displayed correctly, except for the popup button.This is what I see when it's selected:
And this is what I see when it's not selected:
So like you see the cell is empty.The popup button's bindings are:
1. Content: "homes" arranged objects;
2. Content values: "homes" arranged objects.name;
3. Selected object: "people" selection.home .
So coming to the question: why does not the popup button display the relationship name when it's not selected?
PS: The table view is cell based.
That has been a pain to me, and lastly I solved it so there's the explanation for who will find my same problem: I was mixing view based table views with cell based table views.If you want to bind a cell based table view, do not bind the table view content to the managed object context, but bind it's columns.For the popup button I cancelled all bindings and bound it's column this way:
Content: "homes" arranged objects;
Content values: "homes" arranged objects.name;
Selected object: "people" selection.home .
So this may seem the same, but now is the table column to have these bindings, not the button cell.And now all works fine.
Thanks for your answer! I tried to solve such a problem for a couple of hours and the problem was that I had bound the table content to the controller. Now I just bind the column to the controller and everything works as expected.

Edit DataGrid row redirect to another page with holding the data in the coresponding fields?

I have a Data Grid view with the following colums, in VB.Net
Student Name, Address , Phone etc. and edit hyperlinkfield as well.
When I click on the Edit link on a Row, it should redirect me to studentdetails page and carrying the row value to the corresponding controls like Nametext , addresstext, phonetext controls etc.
I am new to vb.net and datagridview. Can anyone let me know how this works?
Thanks in advance
Place code to open the new form/page in the hyperlinkfield's click event. To access the other information from the same row you can use
DataGridViewName.CurrentRow.Cells(studentName).value
or
DataGridViewName.Rows(e.rowIndex).Cells(studentName).value
Then you get these values for the current row and pass them to whatever method in launches your new page, or set as properties on the edit form.

Using grid events

Would anyone let me know how to refresh a grid depending on your selection from another grid. I'm looking at the example at
http://archive.dojotoolkit.org/nightly/checkout/dojox/data/demos/demo_QueryReadStore_grid.html
Is there is any way that the second grid can be updated once you click on any row in the first one. For example Assume that the first table has only the state names and the second one has the capitals. When I click on the State on the first table I only want to see the capital for that state at the second grid.
Please let me know if you have an answer for me.
Thanks,
I would do it this way, using refresh grid to change the store, and the layout of the other grid if necessary using the text value.
grid.onCellClick = function(e) {
refreshGrid(e.cellNode.innerHTML);
};