In this picture i want to add click on script in icon
def runAction(self, event):
	row_id = self.parent.parent.parent.parent.parent.getChild("Table").selection.selectedRow
	row = self.getSibling("Table").props.data.pop(row_id)
	system.db.runNamedQuery("Delete_Rows", parameters=row)
	
	self.parent.parent.parent.parent.parent.getChild("Table").refreshBinding("props.data")
this the script 
i have a named query Delete_Rows
this the named query details so tell me what to do
Any help is welcomed
            
 
            
              
              
              
            
            
           
          
            
            
              
alternatives:
self.view.getChild("root").getChild("Table")...
self.view.getRootContainer().getChild("Table")...
self.view.rootContainer.getChild("Table")...
Expression equivalent:
view.root...
{/root/Table...}
             
            
              
              
              
            
                
            
           
          
            
            
              i want to know the syntax for using selected row or how to use them
             
            
              
              
              
            
            
           
          
            
            
              this may work:
	row = self.getSibling("Table").props.data.get(row_id)
	system.db.runNamedQuery("Delete_Rows", parameters={"id"=row})
             
            
              
              
              
            
            
           
          
            
            
              
it shows a error like this AttributeError
             
            
              
              
              
            
            
           
          
            
            
              
you need to sort this out.  your code has both self.getSibling("Table") and self.parent.parent.parent.parent.parent.getChild("Table")
             
            
              
              
              
            
            
           
          
            
            
              i tried your code same result
             
            
              
              
              
            
            
           
          
            
            
              
this literally means self.getSibling("Table") is wrong ('NoneType object has no attribute 'props')
try browsing to the 'data' property with the GUI:
             
            
              
              
              
            
            
           
          
            
            
              First understand the parent and child relationships. In your other quesiont, refreshBinding not working probably because not called on the right object - #10 by Transistor, you have the structure,
root
  + Flexcontainer
    + Button
  + Table
So, to get from Button to Table you have to go parent (which takes you to Flexcontainer) then you use getSibling to get to Table.
Alternately, you could go parent.parent which takes you to root and then use getChild to get to Table.
If we examine your code below we can see that you have been inconsistent with the relative paths and they are very deep. You can avoid errors if you use the Property Inspector to create the paths for you as shown by Ujwal in the previous question.
def runAction(self, event):
	row_id = self.parent.parent.parent.parent.parent.getChild("Table").selection.selectedRow
	row = self.getSibling("Table").props.data.pop(row_id)
	system.db.runNamedQuery("Delete_Rows", parameters=row)
	
	self.parent.parent.parent.parent.parent.getChild("Table").refreshBinding("props.data")
Other problems
- 
Where did you find documentation on using popon a table properties? I can't find it anywhere.
 
- 
To delete a row WHERE id = :idyou need to retrieve theidvalue from the selected row. Your screengrab doesn't show that column. Maybe you have called itrow_idbut haven't shown it.
 
- 
runNamedQueryexpects a dictionary of parameters. You haven't supplied one.
 
- 
We don't know the relative paths between your components. Please add a screengrab from Project Browser showing the relative positions of the delete button and the table. 
- 
Add the idcolumn to your table if it is not there already. Show that in a screengrab.
 
 
            
              
              
              3 Likes