private static function renderJson($view, $source)
 {
     $rows = $source->getRows();
     self::addRowActionSuffixes($view, $rows);
     if ($view->getBool('@dynamic')) {
         self::changeEditLinks($rows);
     }
     $gridData = new afExtjsGridData();
     $gridData->totalCount = $source->getTotalCount();
     $gridData->data = $rows;
     $additionalData = $source->getAdditionalData();
     if ($additionalData) {
         $gridData->additionalData = $additionalData;
     }
     return afOutput::renderText($gridData->end());
 }
 public static function renderEdit($request, $module, $action, afDomAccess $view)
 {
     $fields = $view->wrapAll('fields/field');
     $submitUrl = self::getSubmitUrl($module, $action, $view);
     $validators = afEditView::getValidators($fields);
     $fileTypes = afEditView::getFileTypes($fields);
     $result = array();
     $result['success'] = true;
     $result['af_submitUrl'] = $request->getUriPrefix() . $submitUrl;
     $instance = afEditShowRenderer::fetchDataInstance($view);
     foreach (self::getFieldValues($instance, $fields) as $name => $value) {
         $result[sprintf('edit[%s]', $name)] = $value;
     }
     $result['af_formcfg'] = self::buildFormcfg($submitUrl, $validators, $fileTypes);
     return afOutput::renderText(json_encode($result));
 }