DataGrid Form Row Change

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
newpie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 155
Joined: Sat Jun 29, 2013 11:24 pm

DataGrid Form Row Change

Post by newpie » Fri Mar 25, 2016 11:50 pm

Hello, I have a datagrid Form and trying to update row in a repeat loop, I confirm the array is being changed, I am just having trouble making it update on screen when repeat loop is done:

Code: Select all

on mouseUp
   put the dgData of group "formGrid" into theDataA
   put the dgIndexes of group "formGrid" into theIndexes
   
   repeat for each item theIndex in theIndexes
      put theDataA[theIndex]["Status"] into tStatus--this value is already in record     
      
      if tStatus= "true" then
         put "pic.png" into theDataA[theIndex]["pic"]
      else
         send "DeleteIndex theIndex" to grp "formGrid"
      end if
   end repeat
   -- I would like to repopulate datagrid with only the records that are left
   send "RefreshList" to grp "formGrid"  --update changes but I suspect this does not put records left at top
end mouseUp
Thanks for any help

Edit: fixed typo
Last edited by newpie on Sat Mar 26, 2016 3:27 pm, edited 1 time in total.

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

Re: DataGrid Form Row Change

Post by sritcp » Sat Mar 26, 2016 3:08 am

Hi newbie:

Code: Select all

send "RefreshList" to grp "addGrid"
Was "addGrid" a typo? Should it not be "formGrid"?

Regards,
Sri

newpie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 155
Joined: Sat Jun 29, 2013 11:24 pm

Re: DataGrid Form Row Change

Post by newpie » Sat Mar 26, 2016 4:19 pm

This seems to have done the trick for the update of the pic if it helps anyone. Thanks

Code: Select all

    on mouseUp
       put the dgData of group "formGrid" into theDataA
       put the dgIndexes of group "formGrid" into theIndexes
       
       repeat for each item theIndex in theIndexes
          put theDataA[theIndex]["Status"] into tStatus--this value is already in record     
         
          if tStatus= "true" then
             put "pic.png" into theDataA[theIndex]["pic"]
          else
             send "DeleteIndex theIndex" to grp "formGrid"
          end if
       end repeat
       set the dgData of group "formGrid" to theDataA
       dispatch "RefreshList" to grp "formGrid"
    end mouseUp

Post Reply