cocoa - NSBrowser / NSTreeController with async data -


i have nsbrowser needs display data comes rest api. api takes while return results, nice handle network traffic in background (lazy fetching). subtree needs refresh reflect server side changes.

i've tried 2 different approaches:

  1. using nsbrowserdelegate. when [browserdelegate browser:child:ofitem:] or similar function ends requesting data not yet loaded, return 0 count , kick off background processing. when data becomes available have columns reloaded (not efficient, messes user's selection new data comes in).
  2. using nstreecontroller. got work using blocking/synchronous approach. however, whenever update model, nsbrowser resets tree , moves selection parent. i've tried [obj mutablearrayvalueforkey] approach. i've tried [treecontroller insertobject:atarrangedobjectindexpath:] approach. i've toggled "preserve selections" flag. i've toggled "select on insert". no matter do, nsbrowser doesn't want cleanly update relevant subtree.

bottom line: best practice asynchronously loading data nsbrowser?


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -