add,view,edit,delete

You must Login before you can answer or comment on any questions.

Hi, I want to create this page . I have used 3 tabs for this .

1- tab for ADD 2- tab for view,edit(Button),delete (button) 3-tab edit form fetching from db

The problem is in tab-2 and tab-3

dataArray.push({title:'' + DistrictName.fieldByName('DistrictName'), hasChild:true, path:'/DistrictMaster/EditDistrict.js'});
How can i access the id of that row in tablview of which i want to edit. and use this id in my tab-3 (select query)so that i can populate the fields of that id .

Need Help !

1 Answer

The best way to communicate between tabs or windows is sometimes to use custom events. So, in the onclick of the table in your first tab, something like this:

tableView.addEventListener("click",function(evt){
    Ti.App.fireEvent("rowClicked",{rowIndex:evt.index});
});
And then, in your 2nd tab where you do the view/edit/delete stuff, do this:
Ti.App.addEventListener("rowClicked",function(evt){
    var rowIndex = evt.rowIndex;
    // Do stuff here
});
Does that make sense?

App-level events docs

Hope I'm interpreting your question correctly.

Your Answer

Think you can help? Login to answer this question!